当前位置: 首页>>代码示例>>Java>>正文


Java UserDTO类代码示例

本文整理汇总了Java中io.github.jhipster.registry.web.rest.dto.UserDTO的典型用法代码示例。如果您正苦于以下问题:Java UserDTO类的具体用法?Java UserDTO怎么用?Java UserDTO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserDTO类属于io.github.jhipster.registry.web.rest.dto包,在下文中一共展示了UserDTO类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccount

import io.github.jhipster.registry.web.rest.dto.UserDTO; //导入依赖的package包/类
/**
 * GET  /account : get the current user.
 *
 * @return the ResponseEntity with status 200 (OK) and the current user in body, or status 500 (Internal Server
 * Error) if the user couldn't be returned
 */
@GetMapping("/account")
@Timed
public ResponseEntity<UserDTO> getAccount() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    User user = (User) authentication.getPrincipal();
    UserDTO userDTO = new UserDTO(user.getUsername(),
        user.getAuthorities().stream()
            .map(authority -> authority.getAuthority()).collect(Collectors.toSet()));
    return new ResponseEntity<>(userDTO, HttpStatus.OK);
}
 
开发者ID:mraible,项目名称:devoxxus-jhipster-microservices-demo,代码行数:17,代码来源:AccountResource.java

示例2: getAccount

import io.github.jhipster.registry.web.rest.dto.UserDTO; //导入依赖的package包/类
/**
 * GET  /account : get the current user.
 *
 * @return the ResponseEntity with status 200 (OK) and the current user in body, or status 500 (Internal Server
 * Error) if the user couldn't be returned
 */
@RequestMapping(value = "/account",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<UserDTO> getAccount() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    User user = (User) authentication.getPrincipal();
    UserDTO userDTO = new UserDTO(user.getUsername(),
        user.getAuthorities().stream()
            .map(authority -> authority.getAuthority()).collect(Collectors.toSet()));
    return new ResponseEntity<>(userDTO, HttpStatus.OK);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:19,代码来源:AccountResource.java


注:本文中的io.github.jhipster.registry.web.rest.dto.UserDTO类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。