DigestPasswordImpl(final String algorithm, final char[] password, final DigestPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.algorithm = algorithm; this.username = spec.getUsername(); this.realm = spec.getRealm(); try { this.digest = userRealmPasswordDigest(getMessageDigest(algorithm), spec.getUsername(), spec.getRealm(), password); } catch (NoSuchAlgorithmException e) { throw log.invalidKeySpecNoSuchMessageDigestAlgorithm(algorithm); } }
protected void engineEncode(final ASN1Encoder encoder, final DigestPasswordAlgorithmSpec parameterSpec) { encoder.startSequence(); encoder.encodeOctetString(parameterSpec.getUsername()); encoder.encodeOctetString(parameterSpec.getRealm()); encoder.endSequence(); }
if (parameterSpec != null) { // when not null, type already checked in acquire support check DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) parameterSpec; if (! loadedState.getRealmName().equals(spec.getRealm()) || ! accountEntry.getName().equals(spec.getUsername())) { if (log.isTraceEnabled()) { log.tracef("PropertiesRealm: Unable to obtain credential for username [%s] (available [%s]) and realm [%s] (available [%s])", spec.getUsername(), accountEntry.getName(), spec.getRealm(), loadedState.getRealmName());
@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); } }
DigestPasswordImpl(final String algorithm, final char[] password, final DigestPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.algorithm = algorithm; this.username = spec.getUsername(); this.realm = spec.getRealm(); try { this.digest = userRealmPasswordDigest(getMessageDigest(algorithm), spec.getUsername(), spec.getRealm(), password); } catch (NoSuchAlgorithmException e) { throw log.invalidKeySpecNoSuchMessageDigestAlgorithm(algorithm); } }
DigestPasswordImpl(final String algorithm, final char[] password, final DigestPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.algorithm = algorithm; this.username = spec.getUsername(); this.realm = spec.getRealm(); try { this.digest = userRealmPasswordDigest(getMessageDigest(algorithm), spec.getUsername(), spec.getRealm(), password); } catch (NoSuchAlgorithmException e) { throw log.invalidKeySpecNoSuchMessageDigestAlgorithm(algorithm); } }
DigestPasswordImpl(final String algorithm, final char[] password, final DigestPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.algorithm = algorithm; this.username = spec.getUsername(); this.realm = spec.getRealm(); try { this.digest = userRealmPasswordDigest(getMessageDigest(algorithm), spec.getUsername(), spec.getRealm(), password); } catch (NoSuchAlgorithmException e) { throw log.invalidKeySpecNoSuchMessageDigestAlgorithm(algorithm); } }
@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); } }
if (! Objects.equals(digestSpec.getRealm(), realm) || ! Objects.equals(digestSpec.getUsername(), principal.getName())) { return null;
if (! Objects.equals(digestSpec.getRealm(), realm) || ! Objects.equals(digestSpec.getUsername(), principal.getName())) { return null;
if (! Objects.equals(digestSpec.getRealm(), realm) || ! Objects.equals(digestSpec.getUsername(), principal.getName())) { return null;
if (! Objects.equals(digestSpec.getRealm(), realm) || ! Objects.equals(digestSpec.getUsername(), principal.getName())) { return null;
protected void engineEncode(final ASN1Encoder encoder, final DigestPasswordAlgorithmSpec parameterSpec) { encoder.startSequence(); encoder.encodeOctetString(parameterSpec.getUsername()); encoder.encodeOctetString(parameterSpec.getRealm()); encoder.endSequence(); }
protected void engineEncode(final ASN1Encoder encoder, final DigestPasswordAlgorithmSpec parameterSpec) { encoder.startSequence(); encoder.encodeOctetString(parameterSpec.getUsername()); encoder.encodeOctetString(parameterSpec.getRealm()); encoder.endSequence(); }
protected void engineEncode(final ASN1Encoder encoder, final DigestPasswordAlgorithmSpec parameterSpec) { encoder.startSequence(); encoder.encodeOctetString(parameterSpec.getUsername()); encoder.encodeOctetString(parameterSpec.getRealm()); encoder.endSequence(); }
if (! Objects.equals(digestSpec.getRealm(), realmName) || ! Objects.equals(digestSpec.getUsername(), userName)) { return null;
if (! Objects.equals(digestSpec.getRealm(), realmName) || ! Objects.equals(digestSpec.getUsername(), userName)) { return null;
if (parameterSpec != null) { // when not null, type already checked in acquire support check DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) parameterSpec; if (! loadedState.getRealmName().equals(spec.getRealm()) || ! accountEntry.getName().equals(spec.getUsername())) { if (log.isTraceEnabled()) { log.tracef("PropertiesRealm: Unable to obtain credential for username [%s] (available [%s]) and realm [%s] (available [%s])", spec.getUsername(), accountEntry.getName(), spec.getRealm(), loadedState.getRealmName());
if (parameterSpec != null) { // when not null, type already checked in acquire support check DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) parameterSpec; if (! loadedState.getRealmName().equals(spec.getRealm()) || ! accountEntry.getName().equals(spec.getUsername())) { if (log.isTraceEnabled()) { log.tracef("PropertiesRealm: Unable to obtain credential for username [%s] (available [%s]) and realm [%s] (available [%s])", spec.getUsername(), accountEntry.getName(), spec.getRealm(), loadedState.getRealmName());
if (parameterSpec != null) { // when not null, type already checked in acquire support check DigestPasswordAlgorithmSpec spec = (DigestPasswordAlgorithmSpec) parameterSpec; if (! loadedState.getRealmName().equals(spec.getRealm()) || ! accountEntry.getName().equals(spec.getUsername())) { if (log.isTraceEnabled()) { log.tracef("PropertiesRealm: Unable to obtain credential for username [%s] (available [%s]) and realm [%s] (available [%s])", spec.getUsername(), accountEntry.getName(), spec.getRealm(), loadedState.getRealmName());