/** * Create a new configuration which is the same as this configuration, but which uses the given password to authenticate. * * @param password the password to use * @return the new configuration */ public AuthenticationConfiguration usePassword(Password password) { final CredentialSource filtered = getCredentialSource().without(PasswordCredential.class); return password == null ? useCredentials(filtered) : useCredentials(filtered).useCredential(new PasswordCredential(password)); }
/** * Create a new configuration which is the same as this configuration, but which uses the given {@link BearerTokenCredential} to authenticate. * * @param credential the bearer token credential to use * @return the new configuration */ public AuthenticationConfiguration useBearerTokenCredential(BearerTokenCredential credential) { return credential == null ? this : useCredentials(getCredentialSource().with(IdentityCredentials.NONE.withCredential(credential))); }
/** * 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))); }
/** * 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))); }
/** * 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 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)))); }
/** * Create a new configuration which is the same as this configuration, but uses credentials found at the given * alias and credential store. * * @param credentialStore the credential store (must not be {@code null}) * @param alias the alias within the store (must not be {@code null}) * @return the new configuration */ public AuthenticationConfiguration useCredentialStoreEntry(CredentialStore credentialStore, String alias) { Assert.checkNotNullParam("credentialStore", credentialStore); Assert.checkNotNullParam("alias", alias); CredentialStoreCredentialSource csCredentialSource = new CredentialStoreCredentialSource(credentialStore, alias); return useCredentials(getCredentialSource().with(csCredentialSource)); }
globalAuthConf = globalAuthConf.useCredentials(credentials); } else if (passwordBase64 != null) { globalAuthConf = globalAuthConf.usePassword(CodePointIterator.ofString(passwordBase64).base64Decode().asUtf8String().drainToString());
private static AuthenticationConfiguration initializeConfiguration(final URI uri, AuthenticationConfiguration configuration) { final SecurityDomain authenticationNameForwardSecurityDomain = configuration.authenticationNameForwardSecurityDomain; final String userInfo = uri.getUserInfo(); if (userInfo != null && configuration.getPrincipal() == AnonymousPrincipal.getInstance() && authenticationNameForwardSecurityDomain == null) { configuration = configuration.useName(userInfo); } // capture forwards if (authenticationNameForwardSecurityDomain != null) { configuration = configuration.useForwardedAuthenticationIdentity(null).usePrincipal(authenticationNameForwardSecurityDomain.getCurrentSecurityIdentity().getPrincipal()); } final SecurityDomain authenticationCredentialsForwardSecurityDomain = configuration.authenticationCredentialsForwardSecurityDomain; if (authenticationCredentialsForwardSecurityDomain != null) { final SecurityIdentity securityIdentity = authenticationCredentialsForwardSecurityDomain.getCurrentSecurityIdentity(); final IdentityCredentials privateCredentials = securityIdentity.getPrivateCredentials(); final IdentityCredentials publicCredentials = securityIdentity.getPublicCredentials(); // private overrides public configuration = configuration.useForwardedAuthenticationCredentials(null).useCredentials(publicCredentials.with(privateCredentials)); } final SecurityDomain authorizationNameForwardSecurityDomain = configuration.authorizationNameForwardSecurityDomain; if (authorizationNameForwardSecurityDomain != null) { configuration = configuration.useForwardedAuthorizationIdentity(null).useAuthorizationPrincipal(authorizationNameForwardSecurityDomain.getCurrentSecurityIdentity().getPrincipal()); } final AccessControlContext capturedContext = configuration.getCapturedContext(); if (capturedContext == null) { configuration = configuration.withCapturedAccessControlContext(); } return configuration; }
foundBits = setBit(foundBits, 9); final ExceptionSupplier<CredentialSource, ConfigXMLParseException> credentialSource = parseCredentialsType(reader, xmlVersion, keyStoresMap, credentialStoresMap, providerSupplier); configuration = andThenOp(configuration, parentConfig -> parentConfig.useCredentials(credentialSource.get())); break;
/** * Create a new configuration which is the same as this configuration, but which uses the given password to authenticate. * * @param password the password to use * @return the new configuration */ public AuthenticationConfiguration usePassword(Password password) { final CredentialSource filtered = getCredentialSource().without(PasswordCredential.class); return password == null ? useCredentials(filtered) : useCredentials(filtered).useCredential(new PasswordCredential(password)); }
/** * Create a new configuration which is the same as this configuration, but which uses the given password to authenticate. * * @param password the password to use * @return the new configuration */ public AuthenticationConfiguration usePassword(Password password) { final CredentialSource filtered = getCredentialSource().without(PasswordCredential.class); return password == null ? useCredentials(filtered) : useCredentials(filtered).useCredential(new PasswordCredential(password)); }
/** * Create a new configuration which is the same as this configuration, but which uses the given {@link BearerTokenCredential} to authenticate. * * @param credential the bearer token credential to use * @return the new configuration */ public AuthenticationConfiguration useBearerTokenCredential(BearerTokenCredential credential) { return credential == null ? this : useCredentials(getCredentialSource().with(IdentityCredentials.NONE.withCredential(credential))); }
/** * Create a new configuration which is the same as this configuration, but which uses the given {@link BearerTokenCredential} to authenticate. * * @param credential the bearer token credential to use * @return the new configuration */ public AuthenticationConfiguration useBearerTokenCredential(BearerTokenCredential credential) { return credential == null ? this : useCredentials(getCredentialSource().with(IdentityCredentials.NONE.withCredential(credential))); }
/** * 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))); }
/** * 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))); }
/** * 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))); }
/** * 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))); }
/** * 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)))); }
/** * 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)))); }