final String allowedAlgorithm = credentialCallback.getAlgorithm(); if (allowedAlgorithm != null && credentialCallback.isCredentialTypeSupported(X509CertificateChainPrivateCredential.class, allowedAlgorithm)) { final X509KeyManager keyManager; final Credential credential = config.getCredentialSource().getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null && credentialCallback.isCredentialSupported(credential)) { credentialCallback.setCredential(credential);
String requestedRealm = stateRef.get().getMechanismRealmConfiguration().getRealmName(); final Credential credential = getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null) { if (credential instanceof PasswordCredential) {
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); Iterator<Callback> it = list.iterator(); CredentialCallback cb = null; while (it.hasNext()) { Callback callback = it.next(); if (callback instanceof AvailableRealmsCallback) { ((AvailableRealmsCallback) callback).setRealmNames(realmList); it.remove(); } else if (callback instanceof CredentialCallback) { cb = (CredentialCallback) callback; } } // If the only callback was AvailableRealmsCallback, we must not pass it to the AuthorizingCallbackHandler if (!list.isEmpty()) { if (cb != null && cb.getAlgorithm().equals(ALGORITHM_DIGEST_MD5)) { // It's necessary to add the NameCallback with the CredentialCallback, otherwise a UserNotFoundException is thrown DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) cb.getParameterSpec(); list.add(new NameCallback("User", spec.getUsername())); callbacks = list.toArray(new Callback[list.size()]); } delegate.handle(callbacks); } }
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { // We have to provide the available realms via this callback // Ideally we would utilise org.wildfly.security.sasl.util.AvailableRealmsSaslServerFactory, however as we can't // pass the SaslServerFactory impl to JGroups we must do it here instead. ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); Iterator<Callback> it = list.iterator(); CredentialCallback cb = null; while (it.hasNext()) { Callback callback = it.next(); if (callback instanceof AvailableRealmsCallback) { ((AvailableRealmsCallback) callback).setRealmNames(realmList); it.remove(); } else if (callback instanceof CredentialCallback) { cb = (CredentialCallback) callback; } } // If the only callback was AvailableRealmsCallback, we must not pass it to the AuthorizingCallbackHandler if (!list.isEmpty()) { if (cb != null && cb.getAlgorithm().equals(ALGORITHM_DIGEST_MD5)) { // It's necessary to add the NameCallback with the CredentialCallback, otherwise a UserNotFoundException is thrown DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) cb.getParameterSpec(); list.add(new NameCallback("User", spec.getUsername())); callbacks = list.toArray(new Callback[list.size()]); } getMechCallbackHandler().handle(callbacks); } }
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(credential.toCharArray()); } else if (callback instanceof NameCallback) { ((NameCallback) callback).setName(name); } else if (callback instanceof RealmCallback) { ((RealmCallback) callback).setText(realm); } else if (callback instanceof CredentialCallback) { CredentialCallback cb = (CredentialCallback) callback; Password password; switch (cb.getAlgorithm()) { case ALGORITHM_CLEAR: password = ClearPassword.createRaw(ALGORITHM_CLEAR, credential.toCharArray()); break; case ALGORITHM_DIGEST_MD5: byte[] decodedDigest = ByteIterator.ofBytes(credential.getBytes(StandardCharsets.UTF_8)).hexDecode().drain(); password = DigestPassword.createRaw(ALGORITHM_DIGEST_MD5, name, realm, decodedDigest); break; default: continue; } cb.setCredential(cb.getCredentialType().cast(new PasswordCredential(password))); } } }
String algorithmName = cc.getAlgorithm(); final Password password; if ((algorithmName == null || ALGORITHM_CLEAR.equals(algorithmName)) && plainText) {
String algorithmName = cc.getAlgorithm(); final Password password; if ((algorithmName == null || ALGORITHM_CLEAR.equals(algorithmName)) && plainText) {
final String allowedAlgorithm = credentialCallback.getAlgorithm(); if (allowedAlgorithm != null && credentialCallback.isCredentialTypeSupported(X509CertificateChainPrivateCredential.class, allowedAlgorithm)) { final X509KeyManager keyManager; final Credential credential = config.getCredentialSource().getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null && credentialCallback.isCredentialSupported(credential)) { credentialCallback.setCredential(credential);
final String allowedAlgorithm = credentialCallback.getAlgorithm(); if (allowedAlgorithm != null && credentialCallback.isCredentialTypeSupported(X509CertificateChainPrivateCredential.class, allowedAlgorithm)) { final X509KeyManager keyManager; final Credential credential = config.getCredentialSource().getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null && credentialCallback.isCredentialSupported(credential)) { credentialCallback.setCredential(credential);
final String allowedAlgorithm = credentialCallback.getAlgorithm(); if (allowedAlgorithm != null && credentialCallback.isCredentialTypeSupported(X509CertificateChainPrivateCredential.class, allowedAlgorithm)) { final X509KeyManager keyManager; final Credential credential = config.getCredentialSource().getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null && credentialCallback.isCredentialSupported(credential)) { credentialCallback.setCredential(credential);
String algorithm = credentialCallback.getAlgorithm(); final PasswordFactory passwordFactory; final PasswordSpec passwordSpec;
String algorithm = credentialCallback.getAlgorithm(); final PasswordFactory passwordFactory; final PasswordSpec passwordSpec;
String requestedRealm = stateRef.get().getMechanismRealmConfiguration().getRealmName(); final Credential credential = getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null) { if (credential instanceof PasswordCredential) {
String requestedRealm = stateRef.get().getMechanismRealmConfiguration().getRealmName(); final Credential credential = getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null) { if (credential instanceof PasswordCredential) {
String requestedRealm = stateRef.get().getMechanismRealmConfiguration().getRealmName(); final Credential credential = getCredential(credentialCallback.getCredentialType(), credentialCallback.getAlgorithm(), credentialCallback.getParameterSpec()); if (credential != null) { if (credential instanceof PasswordCredential) {