if (!hasChallengeResponse) {
if (clientCertificate != null) {
// Request for challenge
ByteString challenge = loginService.getChallenge(clientCertificate);
if (challenge != null) {
V2AuthResponse response = new V2AuthResponse();
response.challenge = BaseEncoding.base64().encode(challenge.toByteArray());
return response;
}
}
}
}
AuthenticatedUser authentication = null;
if (authRequest != null) {
authentication = loginService.authenticate(authRequest, clientCertificate);
}
if (authentication == null) {
throw new WebApplicationException(Status.UNAUTHORIZED);
}
V2AuthResponse response = new V2AuthResponse();
Access access = response.access = new Access();
V2Token token = access.token = new V2Token();
ProjectData project = authentication.getProject();