use of com.hubspot.singularity.WebhookAuthUser in project Singularity by HubSpot.
the class RawUserResponseParser method parse.
SingularityUserPermissionsResponse parse(Response response) throws IOException {
if (response.getStatusCode() > 299) {
throw WebExceptions.unauthorized(String.format("Got status code %d when verifying jwt", response.getStatusCode()));
} else {
String responseBody = response.getResponseBody();
WebhookAuthUser user = objectMapper.readValue(responseBody, WebhookAuthUser.class);
return new SingularityUserPermissionsResponse(Optional.of(new SingularityUser(user.getUid(), Optional.of(user.getUid()), authConfiguration.getDefaultEmailDomain().map(d -> String.format("%s@%s", user.getUid(), d)), user.getGroups(), user.getScopes(), true)), Optional.empty());
}
}
Aggregations