本文整理汇总了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);
}
示例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);
}