/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type * @param credentialAlias to find the credential in the store * @param credentialType - credential type to retrieve from under the credentialAlias from the store * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException - if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved * @throws UnsupportedCredentialTypeException when the credentialType is not supported */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { return retrieve(credentialAlias, credentialType, null, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param parameterSpec the parameter specification to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, parameterSpec, null); }
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); try { final CredentialStore credentialStore = credentialStoreFactory.create(); if (log.isTraceEnabled()) { log.tracef("CredentialStoreCredentialSource: obtaining credential: type = %s algorithm = %s exists = %b", alias, credentialType, credentialStore.exists(alias, credentialType)); } return credentialStore.retrieve(alias, credentialType, algorithmName, parameterSpec); } catch (UnsupportedCredentialTypeException e) { return null; } catch (GeneralSecurityException e) { throw log.unableToReadCredential(e); } } }
/** * Retrieve credential stored in the store under the key and of the credential type * @param credentialAlias to find the credential in the store * @param credentialType - credential type to retrieve from under the credentialAlias from the store * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException - if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved * @throws UnsupportedCredentialTypeException when the credentialType is not supported */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { return retrieve(credentialAlias, credentialType, null, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type * @param credentialAlias to find the credential in the store * @param credentialType - credential type to retrieve from under the credentialAlias from the store * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException - if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved * @throws UnsupportedCredentialTypeException when the credentialType is not supported */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { return retrieve(credentialAlias, credentialType, null, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type * @param credentialAlias to find the credential in the store * @param credentialType - credential type to retrieve from under the credentialAlias from the store * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException - if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved * @throws UnsupportedCredentialTypeException when the credentialType is not supported */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { return retrieve(credentialAlias, credentialType, null, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, null, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param parameterSpec the parameter specification to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, parameterSpec, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param parameterSpec the parameter specification to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, parameterSpec, null); }
/** * Retrieve credential stored in the store under the key and of the credential type. * * @param credentialAlias to find the credential in the store * @param credentialType credential type to retrieve from under the credentialAlias from the store * @param credentialAlgorithm the credential algorithm to match, or {@code null} to match any * @param parameterSpec the parameter specification to match, or {@code null} to match any * @param <C> the class of type to which should be credential casted * @return instance of {@link Credential} stored in the store * @throws CredentialStoreException if credentialAlias credentialType combination doesn't exist or credentialAlias cannot be retrieved */ public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec) throws CredentialStoreException { return retrieve(credentialAlias, credentialType, credentialAlgorithm, parameterSpec, null); }
Password password = cs.retrieve(alias, PasswordCredential.class).getPassword(); if (password instanceof ClearPassword) { clearPassword = new String(((ClearPassword) password).getPassword());
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); try { final CredentialStore credentialStore = credentialStoreFactory.create(); if (log.isTraceEnabled()) { log.tracef("CredentialStoreCredentialSource: obtaining credential: type = %s algorithm = %s exists = %b", alias, credentialType, credentialStore.exists(alias, credentialType)); } return credentialStore.retrieve(alias, credentialType, algorithmName, parameterSpec); } catch (UnsupportedCredentialTypeException e) { return null; } catch (GeneralSecurityException e) { throw log.unableToReadCredential(e); } } }
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); try { final CredentialStore credentialStore = credentialStoreFactory.create(); if (log.isTraceEnabled()) { log.tracef("CredentialStoreCredentialSource: obtaining credential: type = %s algorithm = %s exists = %b", alias, credentialType, credentialStore.exists(alias, credentialType)); } return credentialStore.retrieve(alias, credentialType, algorithmName, parameterSpec); } catch (UnsupportedCredentialTypeException e) { return null; } catch (GeneralSecurityException e) { throw log.unableToReadCredential(e); } } }
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); try { final CredentialStore credentialStore = credentialStoreFactory.create(); if (log.isTraceEnabled()) { log.tracef("CredentialStoreCredentialSource: obtaining credential: type = %s algorithm = %s exists = %b", alias, credentialType, credentialStore.exists(alias, credentialType)); } return credentialStore.retrieve(alias, credentialType, algorithmName, parameterSpec); } catch (UnsupportedCredentialTypeException e) { return null; } catch (GeneralSecurityException e) { throw log.unableToReadCredential(e); } } }
String alias = ALIAS.resolveModelAttribute(context, operation).asString(); CredentialStore credentialStore = credentialStoreService.getValue(); PasswordCredential retrieved = credentialStore.retrieve(alias, PasswordCredential.class); if (retrieved == null) { throw ROOT_LOGGER.credentialDoesNotExist(alias, PasswordCredential.class.getName());