@Test public void testCreateTokenFromCredentialsSetsAttribute() { SimpleCredentials sc = new SimpleCredentials(userId, new char[0]); tokenProvider.createToken(sc); assertArrayEquals(new String[] {TOKEN_ATTRIBUTE}, sc.getAttributeNames()); }
@Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials) { Credentials creds = extractCredentials(credentials); String uid = (creds != null) ? credentialsSupport.getUserId(creds) : null; TokenInfo tokenInfo = null; if (uid != null) { Map<String, ?> attributes = credentialsSupport.getAttributes(creds); tokenInfo = createToken(uid, attributes); if (tokenInfo != null) { if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) { log.debug("Cannot set token attribute to {}", creds); } } } return tokenInfo; }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials) { Credentials creds = extractCredentials(credentials); String uid = (creds != null) ? credentialsSupport.getUserId(creds) : null; TokenInfo tokenInfo = null; if (uid != null) { Map<String, ?> attributes = credentialsSupport.getAttributes(creds); tokenInfo = createToken(uid, attributes); if (tokenInfo != null) { if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) { log.debug("Cannot set token attribute to {}", creds); } } } return tokenInfo; } }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials) { Credentials creds = extractCredentials(credentials); String uid = (creds != null) ? credentialsSupport.getUserId(creds) : null; TokenInfo tokenInfo = null; if (uid != null) { Map<String, ?> attributes = credentialsSupport.getAttributes(creds); tokenInfo = createToken(uid, attributes); if (tokenInfo != null) { if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) { log.debug("Cannot set token attribute to {}", creds); } } } return tokenInfo; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials) { Credentials creds = extractCredentials(credentials); String uid = (creds != null) ? credentialsSupport.getUserId(creds) : null; TokenInfo tokenInfo = null; if (uid != null) { Map<String, ?> attributes = credentialsSupport.getAttributes(creds); tokenInfo = createToken(uid, attributes); if (tokenInfo != null) { if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) { log.debug("Cannot set token attribute to {}", creds); } } } return tokenInfo; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); @Override boolean doCreateToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes); @Nullable @Override TokenInfo getTokenInfo(@NotNull String token); }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials) { Credentials creds = extractCredentials(credentials); String uid = (creds != null) ? credentialsSupport.getUserId(creds) : null; TokenInfo tokenInfo = null; if (uid != null) { Map<String, ?> attributes = credentialsSupport.getAttributes(creds); tokenInfo = createToken(uid, attributes); if (tokenInfo != null) { if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) { log.debug("Cannot set token attribute to {}", creds); } } } return tokenInfo; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); @Override boolean doCreateToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes); @Nullable @Override TokenInfo getTokenInfo(@NotNull String token);  }