test_class.declarator: userId
test_class.modifier: private
test_class.original_string: private String userId;
test_class.type: String
test_class.var_name: userId
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
test_class.identifier: TokenProviderImplTest
test_class.superclass: extends AbstractTokenTest
test_case.body: @Test
      public void testCreateTokenFromInvalidCredentials() {
          List<Credentials> invalid = new ArrayList<Credentials>();
          invalid.add(new GuestCredentials());
          invalid.add(new TokenCredentials("sometoken"));
          invalid.add(new ImpersonationCredentials(new GuestCredentials(), null));
          invalid.add(new SimpleCredentials("unknownUserId", new char[0]));
  
          for (Credentials creds : invalid) {
              assertNull(tokenProvider.createToken(creds));
          }
      }
test_case.class_method_signature: TokenProviderImplTest.testCreateTokenFromInvalidCredentials()
test_case.full_signature: @Test public void testCreateTokenFromInvalidCredentials()
test_case.identifier: testCreateTokenFromInvalidCredentials
test_case.invocations: add add add add assertNull createToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateTokenFromInvalidCredentials()
focal_class.declarator: log = LoggerFactory.getLogger(TokenProviderImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(TokenProviderImpl.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: PARAM_TOKEN_CLEANUP_THRESHOLD = "tokenCleanupThreshold"
focal_class.modifier: static final
focal_class.original_string: static final String PARAM_TOKEN_CLEANUP_THRESHOLD = "tokenCleanupThreshold";
focal_class.type: String
focal_class.var_name: PARAM_TOKEN_CLEANUP_THRESHOLD
focal_class.declarator: NO_TOKEN_CLEANUP = 0
focal_class.modifier: static final
focal_class.original_string: static final long NO_TOKEN_CLEANUP = 0;
focal_class.type: long
focal_class.var_name: NO_TOKEN_CLEANUP
focal_class.declarator: DEFAULT_TOKEN_EXPIRATION = 2 * 3600 * 1000
focal_class.modifier: static final
focal_class.original_string: static final long DEFAULT_TOKEN_EXPIRATION = 2 * 3600 * 1000;
focal_class.type: long
focal_class.var_name: DEFAULT_TOKEN_EXPIRATION
focal_class.declarator: DEFAULT_KEY_SIZE = 8
focal_class.modifier: static final
focal_class.original_string: static final int DEFAULT_KEY_SIZE = 8;
focal_class.type: int
focal_class.var_name: DEFAULT_KEY_SIZE
focal_class.declarator: DELIM = '_'
focal_class.modifier: private static final
focal_class.original_string: private static final char DELIM = '_';
focal_class.type: char
focal_class.var_name: DELIM
focal_class.declarator: root
focal_class.modifier: private final
focal_class.original_string: private final Root root;
focal_class.type: Root
focal_class.var_name: root
focal_class.declarator: options
focal_class.modifier: private final
focal_class.original_string: private final ConfigurationParameters options;
focal_class.type: ConfigurationParameters
focal_class.var_name: options
focal_class.declarator: credentialsSupport
focal_class.modifier: private final
focal_class.original_string: private final CredentialsSupport credentialsSupport;
focal_class.type: CredentialsSupport
focal_class.var_name: credentialsSupport
focal_class.declarator: tokenExpiration
focal_class.modifier: private final
focal_class.original_string: private final long tokenExpiration;
focal_class.type: long
focal_class.var_name: tokenExpiration
focal_class.declarator: userManager
focal_class.modifier: private final
focal_class.original_string: private final UserManager userManager;
focal_class.type: UserManager
focal_class.var_name: userManager
focal_class.declarator: identifierManager
focal_class.modifier: private final
focal_class.original_string: private final IdentifierManager identifierManager;
focal_class.type: IdentifierManager
focal_class.var_name: identifierManager
focal_class.declarator: cleanupThreshold
focal_class.modifier: private final
focal_class.original_string: private final long cleanupThreshold;
focal_class.type: long
focal_class.var_name: cleanupThreshold
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
focal_class.identifier: TokenProviderImpl
focal_class.interfaces: implements TokenProvider, TokenConstants
focal_class.class_method_signature: TokenProviderImpl.TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration)
focal_class.full_signature:   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration)
focal_class.identifier: TokenProviderImpl
focal_class.parameters: (@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration)
focal_class.signature:  TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration)
focal_class.class_method_signature: TokenProviderImpl.TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport)
focal_class.full_signature:   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport)
focal_class.identifier: TokenProviderImpl
focal_class.parameters: (@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport)
focal_class.signature:  TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport)
focal_class.class_method_signature: TokenProviderImpl.doCreateToken(@NotNull Credentials credentials)
focal_class.full_signature: @Override public boolean doCreateToken(@NotNull Credentials credentials)
focal_class.identifier: doCreateToken
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull Credentials credentials)
focal_class.return: boolean
focal_class.signature: boolean doCreateToken(@NotNull Credentials credentials)
focal_class.class_method_signature: TokenProviderImpl.createToken(@NotNull Credentials credentials)
focal_class.full_signature: @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials)
focal_class.identifier: createToken
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: (@NotNull Credentials credentials)
focal_class.return: TokenInfo
focal_class.signature: TokenInfo createToken(@NotNull Credentials credentials)
focal_class.class_method_signature: TokenProviderImpl.createToken(@NotNull String userId, @NotNull Map<String, ?> attributes)
focal_class.full_signature: @Nullable @Override public TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes)
focal_class.identifier: createToken
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: (@NotNull String userId, @NotNull Map<String, ?> attributes)
focal_class.return: TokenInfo
focal_class.signature: TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes)
focal_class.class_method_signature: TokenProviderImpl.getTokenInfo(@NotNull String token)
focal_class.full_signature: @Nullable @Override public TokenInfo getTokenInfo(@NotNull String token)
focal_class.identifier: getTokenInfo
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: (@NotNull String token)
focal_class.return: TokenInfo
focal_class.signature: TokenInfo getTokenInfo(@NotNull String token)
focal_class.class_method_signature: TokenProviderImpl.createExpirationTime(long creationTime, long tokenExpiration)
focal_class.full_signature: private static long createExpirationTime(long creationTime, long tokenExpiration)
focal_class.identifier: createExpirationTime
focal_class.modifiers: private static
focal_class.parameters: (long creationTime, long tokenExpiration)
focal_class.return: long
focal_class.signature: long createExpirationTime(long creationTime, long tokenExpiration)
focal_class.class_method_signature: TokenProviderImpl.getExpirationTime(@NotNull Tree tokenTree, long defaultValue)
focal_class.full_signature: private static long getExpirationTime(@NotNull Tree tokenTree, long defaultValue)
focal_class.identifier: getExpirationTime
focal_class.modifiers: private static
focal_class.parameters: (@NotNull Tree tokenTree, long defaultValue)
focal_class.return: long
focal_class.signature: long getExpirationTime(@NotNull Tree tokenTree, long defaultValue)
focal_class.class_method_signature: TokenProviderImpl.isExpired(long expirationTime, long loginTime)
focal_class.full_signature: private static boolean isExpired(long expirationTime, long loginTime)
focal_class.identifier: isExpired
focal_class.modifiers: private static
focal_class.parameters: (long expirationTime, long loginTime)
focal_class.return: boolean
focal_class.signature: boolean isExpired(long expirationTime, long loginTime)
focal_class.class_method_signature: TokenProviderImpl.setExpirationTime(@NotNull Tree tree, long time)
focal_class.full_signature: private static void setExpirationTime(@NotNull Tree tree, long time)
focal_class.identifier: setExpirationTime
focal_class.modifiers: private static
focal_class.parameters: (@NotNull Tree tree, long time)
focal_class.return: void
focal_class.signature: void setExpirationTime(@NotNull Tree tree, long time)
focal_class.class_method_signature: TokenProviderImpl.extractCredentials(@NotNull Credentials credentials)
focal_class.full_signature: @Nullable private Credentials extractCredentials(@NotNull Credentials credentials)
focal_class.identifier: extractCredentials
focal_class.modifiers: @Nullable private
focal_class.parameters: (@NotNull Credentials credentials)
focal_class.return: Credentials
focal_class.signature: Credentials extractCredentials(@NotNull Credentials credentials)
focal_class.class_method_signature: TokenProviderImpl.generateKey(int size)
focal_class.full_signature: @NotNull private static String generateKey(int size)
focal_class.identifier: generateKey
focal_class.modifiers: @NotNull private static
focal_class.parameters: (int size)
focal_class.return: String
focal_class.signature: String generateKey(int size)
focal_class.class_method_signature: TokenProviderImpl.getKeyValue(@NotNull String key, @NotNull String userId)
focal_class.full_signature: @NotNull private static String getKeyValue(@NotNull String key, @NotNull String userId)
focal_class.identifier: getKeyValue
focal_class.modifiers: @NotNull private static
focal_class.parameters: (@NotNull String key, @NotNull String userId)
focal_class.return: String
focal_class.signature: String getKeyValue(@NotNull String key, @NotNull String userId)
focal_class.class_method_signature: TokenProviderImpl.isValidTokenTree(@Nullable Tree tokenTree)
focal_class.full_signature: private static boolean isValidTokenTree(@Nullable Tree tokenTree)
focal_class.identifier: isValidTokenTree
focal_class.modifiers: private static
focal_class.parameters: (@Nullable Tree tokenTree)
focal_class.return: boolean
focal_class.signature: boolean isValidTokenTree(@Nullable Tree tokenTree)
focal_class.class_method_signature: TokenProviderImpl.getTokenTree(@NotNull TokenInfoImpl tokenInfo)
focal_class.full_signature: @NotNull private Tree getTokenTree(@NotNull TokenInfoImpl tokenInfo)
focal_class.identifier: getTokenTree
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull TokenInfoImpl tokenInfo)
focal_class.return: Tree
focal_class.signature: Tree getTokenTree(@NotNull TokenInfoImpl tokenInfo)
focal_class.class_method_signature: TokenProviderImpl.getUser(@NotNull Tree tokenTree)
focal_class.full_signature: @Nullable private User getUser(@NotNull Tree tokenTree)
focal_class.identifier: getUser
focal_class.modifiers: @Nullable private
focal_class.parameters: (@NotNull Tree tokenTree)
focal_class.return: User
focal_class.signature: User getUser(@NotNull Tree tokenTree)
focal_class.class_method_signature: TokenProviderImpl.getUser(@NotNull String userId)
focal_class.full_signature: @Nullable private User getUser(@NotNull String userId)
focal_class.identifier: getUser
focal_class.modifiers: @Nullable private
focal_class.parameters: (@NotNull String userId)
focal_class.return: User
focal_class.signature: User getUser(@NotNull String userId)
focal_class.class_method_signature: TokenProviderImpl.getTokenParent(@NotNull User user)
focal_class.full_signature: @Nullable private Tree getTokenParent(@NotNull User user)
focal_class.identifier: getTokenParent
focal_class.modifiers: @Nullable private
focal_class.parameters: (@NotNull User user)
focal_class.return: Tree
focal_class.signature: Tree getTokenParent(@NotNull User user)
focal_class.class_method_signature: TokenProviderImpl.createTokenNode(@NotNull Tree parent, @NotNull String tokenName,
                                        long expTime, @NotNull String uuid,
                                        @NotNull String id, Map<String, ?> attributes)
focal_class.full_signature: @NotNull private TokenInfo createTokenNode(@NotNull Tree parent, @NotNull String tokenName,
                                        long expTime, @NotNull String uuid,
                                        @NotNull String id, Map<String, ?> attributes)
focal_class.identifier: createTokenNode
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull Tree parent, @NotNull String tokenName,
                                        long expTime, @NotNull String uuid,
                                        @NotNull String id, Map<String, ?> attributes)
focal_class.return: TokenInfo
focal_class.signature: TokenInfo createTokenNode(@NotNull Tree parent, @NotNull String tokenName,
                                        long expTime, @NotNull String uuid,
                                        @NotNull String id, Map<String, ?> attributes)
focal_class.class_method_signature: TokenProviderImpl.cleanupExpired(@NotNull String userId, @NotNull Tree parent, long currentTime, @NotNull String token)
focal_class.full_signature: private void cleanupExpired(@NotNull String userId, @NotNull Tree parent, long currentTime, @NotNull String token)
focal_class.identifier: cleanupExpired
focal_class.modifiers: private
focal_class.parameters: (@NotNull String userId, @NotNull Tree parent, long currentTime, @NotNull String token)
focal_class.return: void
focal_class.signature: void cleanupExpired(@NotNull String userId, @NotNull Tree parent, long currentTime, @NotNull String token)
focal_class.class_method_signature: TokenProviderImpl.shouldRunCleanup(@NotNull String token)
focal_class.full_signature: static boolean shouldRunCleanup(@NotNull String token)
focal_class.identifier: shouldRunCleanup
focal_class.modifiers: static
focal_class.parameters: (@NotNull String token)
focal_class.return: boolean
focal_class.signature: boolean shouldRunCleanup(@NotNull String token)
focal_method.body: @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) {
                  // also set the new token to the credentials.
                  if (!credentialsSupport.setAttributes(creds, ImmutableMap.of(TOKEN_ATTRIBUTE, tokenInfo.getToken()))) {
                      log.debug("Cannot set token attribute to {}", creds);
                  }
              }
          }
  
          return tokenInfo;
      }
focal_method.class_method_signature: TokenProviderImpl.createToken(@NotNull Credentials credentials)
focal_method.full_signature: @Nullable @Override public TokenInfo createToken(@NotNull Credentials credentials)
focal_method.identifier: createToken
focal_method.invocations: extractCredentials getUserId getAttributes createToken setAttributes of getToken debug
focal_method.modifiers: @Nullable @Override public
focal_method.parameters: (@NotNull Credentials credentials)
focal_method.return: TokenInfo
focal_method.signature: TokenInfo createToken(@NotNull Credentials credentials)