Package net.ltgt.oidc.servlet
Class AuthenticationRedirector
java.lang.Object
net.ltgt.oidc.servlet.AuthenticationRedirector
Responsible for redirecting to the OpenID Provider.
An instance of this class needs to be added as a ServletContext attribute under the name CONTEXT_ATTRIBUTE_NAME, to be used by the
authorization filters or the LoginServlet.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureAuthenticationRequest(AuthenticationRequest.Builder authenticationRequestBuilder) Called byredirectToAuthenticationEndpointto configure the authentication request further.voidredirectToAuthenticationEndpoint(HttpServletRequest req, HttpServletResponse res, String returnTo) Redirects to the OpenID Provider, returning to the given page when coming back.voidredirectToAuthenticationEndpoint(HttpServletRequest req, HttpServletResponse res, String returnTo, @Nullable Consumer<AuthenticationRequest.Builder> configureAuthenticationRequest) Redirects to the OpenID Provider, returning to the given page when coming back, and possibly configuring the authentication request further.
-
Field Details
-
CONTEXT_ATTRIBUTE_NAME
-
-
Constructor Details
-
AuthenticationRedirector
-
-
Method Details
-
redirectToAuthenticationEndpoint
public void redirectToAuthenticationEndpoint(HttpServletRequest req, HttpServletResponse res, String returnTo) Redirects to the OpenID Provider, returning to the given page when coming back.This is equivalent to
redirectToAuthenticationEndpoint(req, res, returnTo, null). -
redirectToAuthenticationEndpoint
public void redirectToAuthenticationEndpoint(HttpServletRequest req, HttpServletResponse res, String returnTo, @Nullable Consumer<AuthenticationRequest.Builder> configureAuthenticationRequest) Redirects to the OpenID Provider, returning to the given page when coming back, and possibly configuring the authentication request further.The target page should be given as an absolute path (possibly with a query string), though a full URL would be accepted as long as it's the same origin. It will be saved in the session to be redirected to from the
CallbackServlet. -
configureAuthenticationRequest
@ForOverride protected void configureAuthenticationRequest(AuthenticationRequest.Builder authenticationRequestBuilder) Called byredirectToAuthenticationEndpointto configure the authentication request further.The
configuratorpassed toredirectToAuthenticationEndpoint, if any, will be called before this method. ThenredirectToAuthenticationEndpointwill finalize configuration after this method (possibly overwriting some properties) before redirecting.
-