/** * {@inheritDoc} */ @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { Set<Credential> credentials = getCredentials(); if (credentials == null) { throw BaseSecurityMessages.MESSAGES.credentialsNotSet(); } for (Callback cb : callbacks) { if (cb instanceof NameCallback) { for (Credential cred : credentials) { if (cred instanceof NameCredential) { ((NameCallback)cb).setName(((NameCredential)cred).getName()); } } } else if (cb instanceof PasswordCallback) { for (Credential cred : credentials) { if (cred instanceof PasswordCredential) { ((PasswordCallback)cb).setPassword(((PasswordCredential)cred).getPassword()); } } } } }
/** * {@inheritDoc} */ @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { Set<Credential> credentials = getCredentials(); if (credentials == null) { throw BaseSecurityMessages.MESSAGES.credentialsNotSet(); } for (Callback cb : callbacks) { if (cb instanceof NameCallback) { for (Credential cred : credentials) { if (cred instanceof NameCredential) { ((NameCallback)cb).setName(((NameCredential)cred).getName()); } } } else if (cb instanceof PasswordCallback) { for (Credential cred : credentials) { if (cred instanceof PasswordCredential) { ((PasswordCallback)cb).setPassword(((PasswordCredential)cred).getPassword()); } } } } }