diff --git a/src/main/java/it/reply/orchestrator/dto/security/IndigoOAuth2Authentication.java b/src/main/java/it/reply/orchestrator/dto/security/IndigoOAuth2Authentication.java index af2fec8d26..11aa76d540 100644 --- a/src/main/java/it/reply/orchestrator/dto/security/IndigoOAuth2Authentication.java +++ b/src/main/java/it/reply/orchestrator/dto/security/IndigoOAuth2Authentication.java @@ -11,6 +11,17 @@ public class IndigoOAuth2Authentication extends OAuth2Authentication { OAuth2AccessToken token; UserInfo userInfo; + /** + * Generate an {@link IndigoOAuth2Authentication}. + * + * @param authentication + * the {@link OAuth2Authentication}. + * @param token + * the {@link OAuth2AccessToken}. + * @param userInfo + * the {@link UserInfo}. Can be null (i.e. the client is authenticating with its own + * credentials). + */ public IndigoOAuth2Authentication(OAuth2Authentication authentication, OAuth2AccessToken token, UserInfo userInfo) { super(authentication.getOAuth2Request(), authentication.getUserAuthentication()); diff --git a/src/main/java/it/reply/orchestrator/dto/security/IndigoUserInfo.java b/src/main/java/it/reply/orchestrator/dto/security/IndigoUserInfo.java index 420cf58274..effd349740 100644 --- a/src/main/java/it/reply/orchestrator/dto/security/IndigoUserInfo.java +++ b/src/main/java/it/reply/orchestrator/dto/security/IndigoUserInfo.java @@ -19,6 +19,12 @@ public class IndigoUserInfo extends DefaultUserInfo { private List groups; private String organizationName; + /** + * Create an IndigoUserInfo copying the fields from a {@link UserInfo} object. + * + * @param other + * the {@link UserInfo} to copy from. + */ public IndigoUserInfo(UserInfo other) { this.setSub(other.getSub()); this.setPreferredUsername(other.getPreferredUsername()); @@ -79,6 +85,13 @@ public JsonObject toJson() { } } + /** + * Create a {@link UserInfo} from its JSON representation. + * + * @param obj + * {@link JsonObject} containing the JSON representation. + * @return the UserInfo. + */ public static UserInfo fromJson(JsonObject obj) { IndigoUserInfo result = new IndigoUserInfo(DefaultUserInfo.fromJson(obj)); if (obj.has(GROUPS_KEY) && obj.get(GROUPS_KEY).isJsonArray()) { diff --git a/src/main/java/it/reply/orchestrator/service/security/UserInfoIntrospectingTokenService.java b/src/main/java/it/reply/orchestrator/service/security/UserInfoIntrospectingTokenService.java index 2557093029..faf1d5580f 100644 --- a/src/main/java/it/reply/orchestrator/service/security/UserInfoIntrospectingTokenService.java +++ b/src/main/java/it/reply/orchestrator/service/security/UserInfoIntrospectingTokenService.java @@ -1,6 +1,7 @@ package it.reply.orchestrator.service.security; import com.google.common.base.Strings; + import com.nimbusds.jwt.JWT; import com.nimbusds.jwt.JWTParser;