public class SPNEGOAuthnController extends Object
ExternalAuthentication mechanism.
The handler methods either return contents back to the browser by returning an appropriate ResponseEntityExternalAuthentication.finishExternalAuthentication(String, HttpServletRequest, HttpServletResponse) and
returning null. On unrecoverable errors, an exception is thrown.| Modifier and Type | Field and Description |
|---|---|
private org.slf4j.Logger |
log
Class logger.
|
static String |
NTLM_UNSUPPORTED
Event ID indicating that NTLM was attempted by the client.
|
static String |
SPNEGO_NOT_AVAILABLE
Event ID indicating that SPNEGO is not supported by the client or is not available for other reasons.
|
| Constructor and Description |
|---|
SPNEGOAuthnController() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.web.servlet.ModelAndView |
continueSPNEGO(String conversationKey,
String authorizationHeader,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Process an input GSS token from the client and attempt to complete the context establishment process.
|
protected GSSContextAcceptor |
createGSSContextAcceptor(SPNEGOContext spnegoCtx)
Create a new
GSSContextAcceptor object. |
private org.springframework.web.servlet.ModelAndView |
createModelAndView(ProfileRequestContext profileRequestContext,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Create a
ModelAndView object to return. |
private void |
finishWithError(String key,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
String error)
Finish the authentication process with an error.
|
private void |
finishWithException(String key,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
Exception ex)
Finish the authentication process with an exception.
|
private void |
finishWithSuccess(String key,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
KerberosPrincipal kerberosPrincipal)
Finish the authentication process successfully.
|
private SPNEGOContext |
getSPNEGOContext(ProfileRequestContext prc)
Navigate to the
SPNEGOContext in the context tree. |
void |
handleError(String conversationKey,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Respond to a user signaling that an error occurred.
|
private boolean |
isNTLMMechanism(byte[] token)
Check if the GSS-API data represents an NTLM mechanism request.
|
private org.springframework.web.servlet.ModelAndView |
replyUnauthorizedNegotiate(ProfileRequestContext profileRequestContext,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Send back an empty Negotiate challenge.
|
private org.springframework.web.servlet.ModelAndView |
replyUnauthorizedNegotiate(ProfileRequestContext profileRequestContext,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
String base64Token)
Send back a Negotiate challenge token.
|
org.springframework.web.servlet.ModelAndView |
startSPNEGO(String conversationKey,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Handle initial request that starts SPNEGO.
|
@Nonnull @NotEmpty public static final String SPNEGO_NOT_AVAILABLE
@Nonnull @NotEmpty public static final String NTLM_UNSUPPORTED
@Nonnull private final org.slf4j.Logger log
@RequestMapping(value="/{conversationKey}",
method=GET)
@Nullable
public org.springframework.web.servlet.ModelAndView startSPNEGO(@PathVariable@Nonnull@NotEmpty
String conversationKey,
@Nonnull
javax.servlet.http.HttpServletRequest httpRequest,
@Nonnull
javax.servlet.http.HttpServletResponse httpResponse)
throws ExternalAuthenticationException,
IOException
conversationKey - the SWF conversation keyhttpRequest - the HTTP requesthttpResponse - the HTTPÂ responseIOExceptionExternalAuthenticationException@RequestMapping(value="/{conversationKey}",
method=GET,
headers="Authorization")
@Nullable
public org.springframework.web.servlet.ModelAndView continueSPNEGO(@PathVariable@Nonnull@NotEmpty
String conversationKey,
@RequestHeader(value="Authorization")@Nonnull@NotEmpty
String authorizationHeader,
@Nonnull
javax.servlet.http.HttpServletRequest httpRequest,
@Nonnull
javax.servlet.http.HttpServletResponse httpResponse)
throws ExternalAuthenticationException,
IOException
conversationKey - the conversation keyauthorizationHeader - the token from the clienthttpRequest - the HTTP requesthttpResponse - the HTTP responseExternalAuthenticationExceptionIOException@RequestMapping(value="/{conversationKey}/error",
method=GET)
public void handleError(@PathVariable
String conversationKey,
@Nonnull
javax.servlet.http.HttpServletRequest httpRequest,
@Nonnull
javax.servlet.http.HttpServletResponse httpResponse)
throws ExternalAuthenticationException,
IOException
conversationKey - the conversation keyhttpRequest - the HTTP requesthttpResponse - the HTTP responseIOExceptionExternalAuthenticationExceptionprivate void finishWithSuccess(@Nonnull@NotEmpty String key, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse, @Nonnull KerberosPrincipal kerberosPrincipal) throws ExternalAuthenticationException, IOException
Sets the attribute ExternalAuthentication.SUBJECT_KEY.
key - the conversation keyhttpRequest - the HTTP requesthttpResponse - the HTTP responsekerberosPrincipal - the Kerberos principal to returnIOExceptionExternalAuthenticationExceptionprivate void finishWithError(@Nonnull@NotEmpty String key, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse, @Nonnull@NotEmpty String error) throws ExternalAuthenticationException, IOException
Sets the attribute ExternalAuthentication.AUTHENTICATION_ERROR_KEY.
key - the conversation keyhttpRequest - the HTTP requesthttpResponse - the HTTP responseerror - the error string/event to returnIOExceptionExternalAuthenticationExceptionprivate void finishWithException(@Nonnull@NotEmpty String key, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse, @Nonnull Exception ex) throws ExternalAuthenticationException, IOException
Sets the attribute ExternalAuthentication.AUTHENTICATION_EXCEPTION_KEY.
key - the conversation keyhttpRequest - the HTTP requesthttpResponse - the HTTP responseex - the exception that has been thrownIOExceptionExternalAuthenticationException@Nullable private SPNEGOContext getSPNEGOContext(@Nonnull ProfileRequestContext prc)
SPNEGOContext in the context tree.prc - profile request context@Nonnull protected GSSContextAcceptor createGSSContextAcceptor(@Nonnull SPNEGOContext spnegoCtx) throws GSSException
GSSContextAcceptor object.
(Created in a separate method to support unit testing.)spnegoCtx - the SPNEGOContext conteining the KerberosSettingsGSSContextAcceptorGSSException - if an error occurs while creating the GSSContextAcceptor.@Nonnull private org.springframework.web.servlet.ModelAndView replyUnauthorizedNegotiate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse)
profileRequestContext - profile request contexthttpRequest - servlet requesthttpResponse - servlet responseModelAndView wrapping the response@Nonnull private org.springframework.web.servlet.ModelAndView replyUnauthorizedNegotiate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse, @Nonnull String base64Token)
profileRequestContext - profile request contexthttpRequest - servlet requesthttpResponse - servlet responsebase64Token - challenge token to send backModelAndView wrapping the response@Nonnull private org.springframework.web.servlet.ModelAndView createModelAndView(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull javax.servlet.http.HttpServletRequest httpRequest, @Nonnull javax.servlet.http.HttpServletResponse httpResponse)
ModelAndView object to return.profileRequestContext - profile request contexthttpRequest - the HTTP requesthttpResponse - the HTTP responseprivate boolean isNTLMMechanism(@Nonnull byte[] token)
token - token retrieved from the Authorization header.Copyright © 1999–2018 Shibboleth Consortium. All rights reserved.