/** * Create the {@code AuthInfo} for the specified {@code tokenInfo} as well as * userId and principals, that have been set upon {@link #login}. * * @param tokenInfo The tokenInfo to retrieve attributes from. * @return The {@code AuthInfo} resulting from the successful login. */ @Nullable private static AuthInfo getAuthInfo(@Nullable TokenInfo tokenInfo, @NotNull Set<? extends Principal> principals) { if (tokenInfo != null) { Map<String, Object> attributes = new HashMap<>(); tokenInfo.getPublicAttributes().forEach((key, value) -> attributes.put(key, value)); return new AuthInfoImpl(tokenInfo.getUserId(), attributes, principals); } else { return null; } }
/** * Create the {@code AuthInfo} for the specified {@code tokenInfo} as well as * userId and principals, that have been set upon {@link #login}. * * @param tokenInfo The tokenInfo to retrieve attributes from. * @return The {@code AuthInfo} resulting from the successful login. */ @Nullable private static AuthInfo getAuthInfo(@Nullable TokenInfo tokenInfo, @NotNull Set<? extends Principal> principals) { if (tokenInfo != null) { Map<String, Object> attributes = new HashMap<>(); tokenInfo.getPublicAttributes().forEach((key, value) -> attributes.put(key, value)); return new AuthInfoImpl(tokenInfo.getUserId(), attributes, principals); } else { return null; } }
/** * Create the {@code AuthInfo} for the specified {@code tokenInfo} as well as * userId and principals, that have been set upon {@link #login}. * * @param tokenInfo The tokenInfo to retrieve attributes from. * @return The {@code AuthInfo} resulting from the successful login. */ @CheckForNull private AuthInfo getAuthInfo(@Nullable TokenInfo tokenInfo, @Nonnull Set<? extends Principal> principals) { if (tokenInfo != null) { Map<String, Object> attributes = new HashMap<String, Object>(); Map<String, String> publicAttributes = tokenInfo.getPublicAttributes(); for (String attrName : publicAttributes.keySet()) { attributes.put(attrName, publicAttributes.get(attrName)); } return new AuthInfoImpl(tokenInfo.getUserId(), attributes, principals); } else { return null; } }
TokenCredentials tc = new TokenCredentials(ti.getToken()); ti.getPrivateAttributes().forEach((key, value) -> tc.setAttribute(key, value)); ti.getPublicAttributes().forEach((key, value) -> tc.setAttribute(key, value)); sharedState.put(SHARED_KEY_ATTRIBUTES, ti.getPublicAttributes()); updateSubject(tc, null, null); } else {
TokenCredentials tc = new TokenCredentials(ti.getToken()); ti.getPrivateAttributes().forEach((key, value) -> tc.setAttribute(key, value)); ti.getPublicAttributes().forEach((key, value) -> tc.setAttribute(key, value)); sharedState.put(SHARED_KEY_ATTRIBUTES, ti.getPublicAttributes()); updateSubject(tc, null, null); } else {
tc.setAttribute(name, attributes.get(name)); attributes = ti.getPublicAttributes(); for (String name : attributes.keySet()) { tc.setAttribute(name, attributes.get(name));
Map<String,String> pubAttr = info.getPublicAttributes(); assertEquals("public attributes",publicAttributes.size(), pubAttr.size()); for (String key : publicAttributes.keySet()) {