Package net.shibboleth.idp.authn.impl
Class RemoteUserAuthServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
net.shibboleth.idp.authn.impl.RemoteUserAuthServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class RemoteUserAuthServlet
extends javax.servlet.http.HttpServlet
Extracts authentication information from the request and returns it via the IdP's external authentication
interface.
Common usage allows for extraction of REMOTE_USER or a username from request attributes or headers.
More advanced features include the ability to directly consume a Subject
from a request
attribute (in which case it is returned sight unseen directly to the IdP as the external result)
and the ability to check a header for strings containing authentication method identifiers which
can be mapped back into custom Principal
objects (in which case they are attached to a newly
constructed Subject
to return).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Init parameter identifying a header to check for one or more proxied authenticating authority strings.private static final String
Init parameter identifying a header to check for one or more authentication method strings.private String
Header to check for proxied authenticating authority strings.private String
Header to check for authentication method strings.private static final String
Init parameter controlling what attributes to check.private static final String
Init parameter controlling what headers to check.private static final String
Init parameter controlling whether to check for REMOTE_USER.private Collection<String>
List of request attributes to check for an identity.private Collection<String>
List of request headers to check for an identity.private boolean
Whether to check REMOTE_USER for an identity.private final org.slf4j.Logger
Class logger.private static final long
Serial UID.private static final String
Init parameter identifying an attribute to check for a Subject.private String
Request attribute to check for aSubject
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAuthenticationFlowDescriptor
(String key, javax.servlet.http.HttpServletRequest httpRequest) Get the executingAuthenticationFlowDescriptor
.getPrincipal
(AuthenticationFlowDescriptor descriptor, String method) Locate a customPrincipal
matching a string, supported by the flow descriptor.void
init
(javax.servlet.ServletConfig config) protected void
service
(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) void
setAuthnAuthorityHeader
(String header) Set the name of a request header to check for authenticating authority strings.void
setAuthnMethodHeader
(String header) Set the name of a request header to check for authentication method strings.void
setCheckAttributes
(Collection<String> attributes) Set the list of request attributes to check for an identity.void
setCheckHeaders
(Collection<String> headers) Set the list of request headers to check for an identity.void
setCheckRemoteUser
(boolean flag) Set whether to check REMOTE_USER for an identity.void
setSubjectAttribute
(String attribute) Set the name of a request attribute to check for aSubject
.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial UID.- See Also:
-
CHECK_REMOTE_USER_PARAM
Init parameter controlling whether to check for REMOTE_USER.- See Also:
-
CHECK_ATTRIBUTES_PARAM
Init parameter controlling what attributes to check.- See Also:
-
CHECK_HEADERS_PARAM
Init parameter controlling what headers to check.- See Also:
-
SUBJECT_ATTRIBUTE_PARAM
Init parameter identifying an attribute to check for a Subject.- See Also:
-
AUTHN_METHOD_HEADER_PARAM
Init parameter identifying a header to check for one or more authentication method strings.- See Also:
-
AUTHN_AUTHORITY_HEADER_PARAM
Init parameter identifying a header to check for one or more proxied authenticating authority strings.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
checkRemoteUser
private boolean checkRemoteUserWhether to check REMOTE_USER for an identity. Defaults to true. -
checkAttributes
List of request attributes to check for an identity. -
checkHeaders
List of request headers to check for an identity. -
subjectAttribute
Request attribute to check for aSubject
. -
authnMethodHeader
Header to check for authentication method strings. -
authnAuthorityHeader
Header to check for proxied authenticating authority strings.
-
-
Constructor Details
-
RemoteUserAuthServlet
public RemoteUserAuthServlet()Constructor.
-
-
Method Details
-
setCheckRemoteUser
public void setCheckRemoteUser(boolean flag) Set whether to check REMOTE_USER for an identity.- Parameters:
flag
- value to set
-
setCheckAttributes
Set the list of request attributes to check for an identity.- Parameters:
attributes
- list of request attributes to check
-
setCheckHeaders
Set the list of request headers to check for an identity.- Parameters:
headers
- list of request headers to check
-
setSubjectAttribute
Set the name of a request attribute to check for aSubject
.- Parameters:
attribute
- request attribute name
-
setAuthnMethodHeader
Set the name of a request header to check for authentication method strings.- Parameters:
header
- request header name
-
setAuthnAuthorityHeader
Set the name of a request header to check for authenticating authority strings.- Parameters:
header
- request header name- Since:
- 3.4.0
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
service
protected void service(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException - Overrides:
service
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
getAuthenticationFlowDescriptor
@Nullable public AuthenticationFlowDescriptor getAuthenticationFlowDescriptor(@Nonnull @NotEmpty String key, @Nonnull javax.servlet.http.HttpServletRequest httpRequest) throws ExternalAuthenticationException Get the executingAuthenticationFlowDescriptor
.- Parameters:
key
- external authentication keyhttpRequest
- servlet request- Returns:
- active descriptor, or null
- Throws:
ExternalAuthenticationException
- if unable to access the profile context
-
getPrincipal
@Nullable public Principal getPrincipal(@Nonnull AuthenticationFlowDescriptor descriptor, @Nonnull @NotEmpty String method) Locate a customPrincipal
matching a string, supported by the flow descriptor.- Parameters:
descriptor
- flow descriptormethod
- method string- Returns:
- a custom
Principal
or null
-