mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
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:
@@ -382,7 +382,7 @@ public class SSHClient
|
|||||||
* @param supportedOid first supported OID
|
* @param supportedOid first supported OID
|
||||||
* @param supportedOids other supported OIDs
|
* @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
|
* @throws TransportException if there was a transport-layer error
|
||||||
*/
|
*/
|
||||||
public void authGssApiWithMic(String username, LoginContext context, Oid supportedOid, Oid... supportedOids)
|
public void authGssApiWithMic(String username, LoginContext context, Oid supportedOid, Oid... supportedOids)
|
||||||
|
|||||||
@@ -27,13 +27,19 @@ public class AuthGssApiWithMic
|
|||||||
|
|
||||||
private final LoginContext loginContext;
|
private final LoginContext loginContext;
|
||||||
private final List<Oid> mechanismOids;
|
private final List<Oid> mechanismOids;
|
||||||
|
private final GSSManager manager;
|
||||||
|
|
||||||
private GSSContext secContext;
|
private GSSContext secContext;
|
||||||
|
|
||||||
public AuthGssApiWithMic(LoginContext loginContext, List<Oid> mechanismOids) {
|
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");
|
super("gssapi-with-mic");
|
||||||
this.loginContext = loginContext;
|
this.loginContext = loginContext;
|
||||||
this.mechanismOids = mechanismOids;
|
this.mechanismOids = mechanismOids;
|
||||||
|
this.manager = manager;
|
||||||
|
|
||||||
secContext = null;
|
secContext = null;
|
||||||
}
|
}
|
||||||
@@ -70,7 +76,6 @@ public class AuthGssApiWithMic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GSSContext run() throws GSSException {
|
public GSSContext run() throws GSSException {
|
||||||
GSSManager manager = GSSManager.getInstance();
|
|
||||||
GSSName clientName = manager.createName(params.getUsername(), GSSName.NT_USER_NAME);
|
GSSName clientName = manager.createName(params.getUsername(), GSSName.NT_USER_NAME);
|
||||||
GSSCredential clientCreds = manager.createCredential(clientName, GSSContext.DEFAULT_LIFETIME, selectedOid, GSSCredential.INITIATE_ONLY);
|
GSSCredential clientCreds = manager.createCredential(clientName, GSSContext.DEFAULT_LIFETIME, selectedOid, GSSCredential.INITIATE_ONLY);
|
||||||
GSSName peerName = manager.createName("host@" + params.getTransport().getRemoteHost(), GSSName.NT_HOSTBASED_SERVICE);
|
GSSName peerName = manager.createName("host@" + params.getTransport().getRemoteHost(), GSSName.NT_HOSTBASED_SERVICE);
|
||||||
|
|||||||
Reference in New Issue
Block a user