Package davmail.http
Class KerberosHelper
java.lang.Object
davmail.http.KerberosHelper
Kerberos helper class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classContains server Kerberos context information in server mode. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final KerberosHelper.KerberosCallbackHandlerprotected static final Objectprotected static final org.apache.log4j.Logger -
Method Summary
Modifier and TypeMethodDescriptionacceptSecurityContext(LoginContext serverLoginContext, byte[] token) Check client provided Kerberos token in server login contextstatic byte[]initSecurityContext(String protocol, String host, byte[] token) Get response Kerberos token for host with provided token.static byte[]initSecurityContext(String protocol, String host, GSSCredential delegatedCredentials, byte[] token) Get response Kerberos token for host with provided token, use client provided delegation credentials.protected static ObjectinternalInitSecContext(String protocol, String host, GSSCredential delegatedCredentials, byte[] token) static LoginContextserverLogin(String serverPrincipal, String serverPassword) Create server side Kerberos login context for provided credentials.static voidsetClientPassword(String password) Force client password in callback handlerstatic voidsetClientPrincipal(String principal) Force client principal in callback handler
-
Field Details
-
LOGGER
protected static final org.apache.log4j.Logger LOGGER -
LOCK
-
KERBEROS_CALLBACK_HANDLER
-
-
Method Details
-
setClientPrincipal
Force client principal in callback handler- Parameters:
principal- client principal
-
setClientPassword
Force client password in callback handler- Parameters:
password- client password
-
initSecurityContext
public static byte[] initSecurityContext(String protocol, String host, byte[] token) throws GSSException, LoginException Get response Kerberos token for host with provided token.- Parameters:
protocol- target protocolhost- target hosttoken- input token- Returns:
- response token
- Throws:
GSSException- on errorLoginException- on error
-
initSecurityContext
public static byte[] initSecurityContext(String protocol, String host, GSSCredential delegatedCredentials, byte[] token) throws GSSException, LoginException Get response Kerberos token for host with provided token, use client provided delegation credentials. Used to authenticate with target host on a gateway server with client credentials, gateway must have its own principal authorized for delegation- Parameters:
protocol- target protocolhost- target hostdelegatedCredentials- client delegated credentialstoken- input token- Returns:
- response token
- Throws:
GSSException- on errorLoginException- on error
-
internalInitSecContext
protected static Object internalInitSecContext(String protocol, String host, GSSCredential delegatedCredentials, byte[] token) -
serverLogin
public static LoginContext serverLogin(String serverPrincipal, String serverPassword) throws LoginException Create server side Kerberos login context for provided credentials.- Parameters:
serverPrincipal- server principalserverPassword- server password- Returns:
- LoginContext server login context
- Throws:
LoginException- on error
-
acceptSecurityContext
public static KerberosHelper.SecurityContext acceptSecurityContext(LoginContext serverLoginContext, byte[] token) throws GSSException Check client provided Kerberos token in server login context- Parameters:
serverLoginContext- server login contexttoken- Kerberos client token- Returns:
- result with client principal and optional returned Kerberos token
- Throws:
GSSException- on error
-