public SupportLevel getCredentialAcquireSupport(final Class<? extends Credential> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { if (isUnsupported(credentialType, algorithmName, parameterSpec)) { return SupportLevel.UNSUPPORTED; } else { return CredentialSource.this.getCredentialAcquireSupport(credentialType, algorithmName, parameterSpec); } }
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { if (isUnsupported(credentialType, algorithmName, parameterSpec)) { return null; } else { return CredentialSource.this.getCredential(credentialType, algorithmName, parameterSpec); } }
/** * Construct a new builder instance. * * @return the new builder instance */ public static Builder builder() { return new Builder(); }
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { C credential = self.getCredential(credentialType, algorithmName, parameterSpec); if (credential != null) { return credential; } else { return other.getCredential(credentialType, algorithmName, parameterSpec); } }
/** * Create a new configuration which is the same as this configuration, but which uses local kerberos ticket cache * to acquire the credential required for authentication. * * @param mechanismOids array of oid's indicating the mechanisms over which the credential is to be acquired * @return the new configuration * * @since 1.2.0 * @deprecated can be ommited - kerberos based authentication mechanism obtains credential himself */ @Deprecated public AuthenticationConfiguration useLocalKerberosCredential(Oid[] mechanismOids) { return useCredentials(getCredentialSource().with(LocalKerberosCredentialSource.builder().setMechanismOids(mechanismOids).build())); }
/** * Create a new configuration which is the same as this configuration, but which uses the given key store and alias * to acquire the credential required for authentication. * * @param keyStore the key store to use * @param alias the key store alias * @return the new configuration */ public AuthenticationConfiguration useKeyStoreCredential(KeyStore keyStore, String alias) { return keyStore == null || alias == null ? this : useCredentials(getCredentialSource().with(new KeyStoreCredentialSource(keyStore, alias, null))); }
/** * <p>Configure OAuth2 Resource Owner Password Grant Type as defined by the OAuth2 specification. * * <p>When using this grant type, make sure to also configure one of the supported client authentication methods. For instance, * make sure to provide client credentials via {@link #clientCredentials(String, String)}. * * @param userName the resource owner's user name * @param password the resource owner's password * @return this instance. */ public Builder useResourceOwnerPassword(String userName, String password) { configureAuthenticationHandler(parameters -> configureResourceOwnerCredentialsParameters(parameters, userName, password)); return this; }
/** * Get a derived credential source which excludes credentials of the given type and optional algorithm. * * @param credentialType the credential type to exclude (must not be {@code null}) * @param algorithmName the algorithm name to exclude, or {@code null} to exclude all algorithms (or for credential types which do not use algorithms) * @return the derived credential source (not {@code null}) */ default CredentialSource without(Class<? extends Credential> credentialType, String algorithmName) { return without(credentialType, null, null); }
/** * Determine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable. * * @param credentialType the credential type class (must not be {@code null}) * @return the level of support for this credential type (not {@code null}) * @throws IOException if the credential source failed to determine the support level */ default SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); return getCredentialAcquireSupport(credentialType, null, null); }
/** * Construct the credential source instance. * * @return the credential source * @throws GeneralSecurityException if there was a failure constructing the password factory */ public CommandCredentialSource build() throws GeneralSecurityException { return new CommandCredentialSource(this); } }
/** * Construct a new builder instance. * * @return the new builder instance */ public static Builder builder() { return new Builder(); }
/** * Creates a new {@link Builder} instance in order to configure and build a {@link OAuth2CredentialSource}. * * @param tokenEndpointUrl the token endpoint that will be used to obtain OAuth2 access tokens * @return a new builder instance */ public static Builder builder(URL tokenEndpointUrl) { return new Builder(tokenEndpointUrl); }
/** * Construct the credential source instance. * * @return the credential source */ public LocalKerberosCredentialSource build() { return new LocalKerberosCredentialSource(mechanismOids); } }
@Override public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws IOException { return getCredential(credentialType, algorithmName, parameterSpec) != null ? SupportLevel.SUPPORTED : SupportLevel.UNSUPPORTED; }
public SupportLevel getCredentialAcquireSupport(final Class<? extends Credential> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { return getCredential(credentialType, algorithmName, parameterSpec) != null ? SupportLevel.SUPPORTED : SupportLevel.UNSUPPORTED; }
private SSLContext resolveSSLContext() { if (!isHttps(tokenEndpointUri)) { return null; } return sslContextSupplier == null ? null : sslContextSupplier.get(); }
/** * Create a new configuration which is the same as this configuration, but which uses the given key store and alias * to acquire the credential required for authentication. * * @param keyStore the key store to use * @param alias the key store alias * @param protectionParameter the protection parameter to use to access the key store entry * @return the new configuration */ public AuthenticationConfiguration useKeyStoreCredential(KeyStore keyStore, String alias, KeyStore.ProtectionParameter protectionParameter) { return keyStore == null || alias == null ? this : useCredentials(getCredentialSource().with(new KeyStoreCredentialSource(keyStore, alias, protectionParameter))); }
public CredentialSource without(final Class<? extends Credential> testCredentialType, final String testAlgorithmName, final AlgorithmParameterSpec testParameterSpec) { final CredentialSource without = CredentialSource.this.without(testCredentialType, testAlgorithmName, testParameterSpec); if (without == NONE || without == IdentityCredentials.NONE) { return NONE; } if (without == CredentialSource.this) { return this; } return CredentialSource.super.without(credentialType, algorithmName, parameterSpec); } };
/** * Create a new configuration which is the same as this configuration, but which uses the given key store and alias * to acquire the credential required for authentication. * * @param keyStoreEntry the key store entry to use * @return the new configuration */ public AuthenticationConfiguration useKeyStoreCredential(KeyStore.Entry keyStoreEntry) { return keyStoreEntry == null ? this : useCredentials(getCredentialSource().with(new KeyStoreCredentialSource(new FixedSecurityFactory<>(keyStoreEntry)))); }
/** * Get a derived credential source which excludes credentials of the given type. * * @param credentialType the credential type to exclude (must not be {@code null}) * @return the derived credential source (not {@code null}) */ default CredentialSource without(Class<? extends Credential> credentialType) { return without(credentialType, null, null); }