Skip to content

Commit

Permalink
do not initialize dummy CallbackHandler for Krb5LoginModule
Browse files Browse the repository at this point in the history
as we enforce password from shared state hash map
  • Loading branch information
kofemann committed Feb 22, 2018
1 parent 51d87d4 commit 43df127
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/main/java/de/desy/opendj/kpa/KerberosPolicyState.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@
import org.opends.server.types.*;

import javax.security.auth.Subject;
import javax.security.auth.callback.*;
import javax.security.auth.login.*;
import java.io.IOException;
import java.util.*;

import static de.desy.opendj.kpa.OpendjKpaMessages.*;
import static org.opends.messages.ExtensionMessages.ERR_LDAP_PTA_MAPPING_ATTRIBUTE_NOT_FOUND;

/**
Expand Down Expand Up @@ -119,19 +116,9 @@ public boolean passwordMatches (final ByteString byteString) throws DirectoryExc
state.put("javax.security.auth.login.name", krb5Principal);
state.put("javax.security.auth.login.password", byteString.toString().toCharArray());

/* Create the noop handler */
CallbackHandler cbh = new CallbackHandler() {
@Override
public void handle (Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
throw new UnsupportedCallbackException(callback, "Unrecognized Callback " + callback);
}
}
};

/* Instantiate the login context */
final Krb5LoginModule loginModule = new Krb5LoginModule();
loginModule.initialize(new Subject(), cbh, state, options);
loginModule.initialize(new Subject(), null, state, options);
try {
loginModule.login();
loginModule.logout();
Expand Down

0 comments on commit 43df127

Please sign in to comment.