@Test public void nullWhenPrincipalsNull() throws Exception { when(keyStore.getPrincipals(any(), any())).thenReturn(null); assertThat(underTest.getAuthenticationCacheKey(token), is(nullValue())); }
@Override @Nullable protected Object getAuthenticationCacheKey(@Nullable final AuthenticationToken token) { if (token != null) { PrincipalCollection principals = keyStore.getPrincipals(format, (char[]) token.getCredentials()); if (principals != null) { return principals.getPrimaryPrincipal(); } } return null; }
BearerTokenRealm extends AuthenticatingRealm { @Override @Nullable protected Object getAuthenticationCacheKey(@Nullable final AuthenticationToken token) { if (token != null) { PrincipalCollection principals = keyStore.getPrincipals(format, (char[]) token.getCredentials()); if (principals != null) { return principals.getPrimaryPrincipal(); } } return null; } }
BearerTokenRealm extends AuthenticatingRealm { @Override @Nullable protected Object getAuthenticationCacheKey(@Nullable final AuthenticationToken token) { if (token != null) { PrincipalCollection principals = keyStore.getPrincipals(format, (char[]) token.getCredentials()); if (principals != null) { return principals.getPrimaryPrincipal(); } } return null; } BearerTokenRealm(final ApiKeyStore keyStore,
                          final UserPrincipalsHelper principalsHelper,
                          final String format); }
BearerTokenRealm extends AuthenticatingRealm { @Override @Nullable protected Object getAuthenticationCacheKey(@Nullable final AuthenticationToken token) { if (token != null) { PrincipalCollection principals = keyStore.getPrincipals(format, (char[]) token.getCredentials()); if (principals != null) { return principals.getPrimaryPrincipal(); } } return null; } BearerTokenRealm(final ApiKeyStore keyStore,
                          final UserPrincipalsHelper principalsHelper,
                          final String format); @Override boolean supports(final AuthenticationToken token); }
BearerTokenRealm extends AuthenticatingRealm { @Override @Nullable protected Object getAuthenticationCacheKey(@Nullable final AuthenticationToken token) { if (token != null) { PrincipalCollection principals = keyStore.getPrincipals(format, (char[]) token.getCredentials()); if (principals != null) { return principals.getPrimaryPrincipal(); } } return null; } BearerTokenRealm(final ApiKeyStore keyStore,
                          final UserPrincipalsHelper principalsHelper,
                          final String format); @Override boolean supports(final AuthenticationToken token); static final String IS_TOKEN_AUTH_KEY; }