use of com.b2international.snowowl.snomed.cis.rest.model.UserData in project snow-owl by b2ihealthcare.
the class CisAuthenticationService method authenticate.
@Operation(summary = "Validates a token, checking if it's assigned to a current session, and retrieves user data.")
@ApiResponses({ @ApiResponse(responseCode = "400", description = "Error"), @ApiResponse(responseCode = "401", description = "Unauthorized") })
@PostMapping(value = "/authenticate")
public UserData authenticate(@Parameter(description = "The security access token.", required = true) @RequestBody Token token) {
String username = verify(token.getToken());
if (Strings.isNullOrEmpty(username)) {
throw new UnauthorizedException("Token does not validate.");
} else {
final UserData userData = new UserData();
userData.setUsername(username);
return userData;
}
}
Aggregations