Class AuthenticationRedirector

java.lang.Object
net.ltgt.oidc.servlet.AuthenticationRedirector
net.ltgt.oidc.servlet.rs.AuthenticationRedirector

public class AuthenticationRedirector extends 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 AuthenticationRedirector.CONTEXT_ATTRIBUTE_NAME, to be used by the servlet authorization filters, Jakarta-RS authorization filters, or the LoginServlet.

In other words, if you're using Jakarta RS, then use an instance of this class instead of than AuthenticationRedirector.

See Also:
  • Field Summary

    Fields inherited from class net.ltgt.oidc.servlet.AuthenticationRedirector

    CONTEXT_ATTRIBUTE_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
    AuthenticationRedirector(net.ltgt.oidc.servlet.Configuration configuration, String callbackPath)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    redirectToAuthenticationEndpoint(jakarta.ws.rs.container.ContainerRequestContext containerRequestContext, HttpServletRequest req, String returnTo)
    Redirects to the OpenID Provider, returning to the given page when coming back.
    void
    redirectToAuthenticationEndpoint(jakarta.ws.rs.container.ContainerRequestContext containerRequestContext, HttpServletRequest req, 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.

    Methods inherited from class net.ltgt.oidc.servlet.AuthenticationRedirector

    configureAuthenticationRequest, redirectToAuthenticationEndpoint, redirectToAuthenticationEndpoint, redirectToAuthenticationEndpoint

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AuthenticationRedirector

      public AuthenticationRedirector(net.ltgt.oidc.servlet.Configuration configuration, String callbackPath)
  • Method Details

    • redirectToAuthenticationEndpoint

      public void redirectToAuthenticationEndpoint(jakarta.ws.rs.container.ContainerRequestContext containerRequestContext, HttpServletRequest req, 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(jakarta.ws.rs.container.ContainerRequestContext containerRequestContext, HttpServletRequest req, 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.