Expose GSSManager in AuthGssApiWithMic

The default implementation only supports Kerberos and encourages
subclassing, so there should be a way to provide subclasses.
This commit is contained in:
Billy Keyes
2015-06-11 11:38:02 -07:00
parent d3d019c1c2
commit 4adc83b9df
2 changed files with 7 additions and 2 deletions

View File

@@ -382,7 +382,7 @@ public class SSHClient
* @param supportedOid first supported OID
* @param supportedOids other supported OIDs
*
* @throws UserAuthException in case of authenication failure
* @throws UserAuthException in case of authentication failure
* @throws TransportException if there was a transport-layer error
*/
public void authGssApiWithMic(String username, LoginContext context, Oid supportedOid, Oid... supportedOids)

View File

@@ -27,13 +27,19 @@ public class AuthGssApiWithMic
private final LoginContext loginContext;
private final List<Oid> mechanismOids;
private final GSSManager manager;
private GSSContext secContext;
public AuthGssApiWithMic(LoginContext loginContext, List<Oid> mechanismOids) {
this(loginContext, mechanismOids, GSSManager.getInstance());
}
public AuthGssApiWithMic(LoginContext loginContext, List<Oid> mechanismOids, GSSManager manager) {
super("gssapi-with-mic");
this.loginContext = loginContext;
this.mechanismOids = mechanismOids;
this.manager = manager;
secContext = null;
}
@@ -70,7 +76,6 @@ public class AuthGssApiWithMic
@Override
public GSSContext run() throws GSSException {
GSSManager manager = GSSManager.getInstance();
GSSName clientName = manager.createName(params.getUsername(), GSSName.NT_USER_NAME);
GSSCredential clientCreds = manager.createCredential(clientName, GSSContext.DEFAULT_LIFETIME, selectedOid, GSSCredential.INITIATE_ONLY);
GSSName peerName = manager.createName("host@" + params.getTransport().getRemoteHost(), GSSName.NT_HOSTBASED_SERVICE);