Current File(s): conf/authn/external-authn-config.xml, conf/authn/authn.properties(V4.1+)
Format: Properties, Native Spring, Properties (V4.1+)
Table of Contents |
---|
Overview
...
Warning |
---|
Once control is transferred to the external path, the IdP has no control over what happens, and it will implicitly trust any information passed back through the defined interface. If that information can be manipulated, security holes may result. The deployer takes full responsibility for the security of the overall exchange. |
Enabling Module (V4.1+)
For V4.1+, configuring and using this feature requires that you first enable the "idp.authn.External" module if it isn't already enabled. Systems upgraded from older releases generally come pre-enabled due to the prior state of the configuration tree.
Code Block |
---|
(Windows)
C:\opt\shibboleth-idp> bin\module.bat -t idp.authn.External || bin\module.bat -e idp.authn.External
(Other)
$ bin/module.sh -t idp.authn.External || bin/module.sh -e idp.authn.External |
General Configuration
Expand | ||
---|---|---|
| ||
Use conf/authn/external-authn-config.xml to configure this flow. The shibboleth.authn.External.externalAuthnPath bean defines the flow redirection path to the resource that's used to perform the external login, by default a context-relative location. It can be modified if needed, but must be a resource with access to the container session. Modify as needed to match the location of your external interface (see the documentation on flow redirects). |
Expand | ||
---|---|---|
| ||
Most of the usual options are available via authn/authn.properties, and some more advanced cases will require defining/adjusting bean definitions in authn/external-authn-config.xml. The idp.authn.External.externalAuthnPath property defines the flow redirection path to the resource that's used to perform the external login, by default a context-relative location. It can be modified if needed, but must be a resource with access to the container session. Modify as needed to match the location of your external interface (see the documentation on flow redirects). |
You may also dynamically derive the path to use, typically so that it can vary based on aspects of the request, by defining a bean named shibboleth.authn.External.externalAuthnPathStrategy of type Function<ProfileRequestContext,String>.
The shibboleth.authn.External.ClassifiedMessageMap is a map of exception/error messages to classified error conditions. You can make use of this map either by modifying it to understand the error or exception messages returned by your external code, or by using the map as is and passing back the literal tokens in the map from your external code via the exception or error message interface.
API
The ExternalAuthentication class makes up the interface between the external code and the IdP. The general flow is:
Call ExternalAuthentication.startExternalAuthentication(HttpServletRequest), saving off the result as a key.
Do work as necessary (reading request details from the attributes below). Any redirects must preserve the key value returned in step 1 because it must be used to complete the login later.
Set request attributes to communicate the result of the login back.
Call ExternalAuthentication.finishExternalAuthentication(String, HttpServletRequest, HttpServletResponse). The first parameter is the key returned in step 1.
Example JSP implementations are below.
...
title | External interface example in JSP |
---|
...
language | java |
---|
...
General Configuration
Most of the usual options are available via authn/authn.properties, and some more advanced cases will require creating new bean definitions in conf/global.xml.
Note for Upgraded Systems
The old file conf/authn/external-authn-config.xml is now supported only for compatibility and generally not installed or needed going forward. Any beans placed there can be defined in global.xml instead.
The idp.authn.External.externalAuthnPath property defines the flow redirection path to the resource that's used to perform the external login, by default a context-relative location. It can be modified if needed, but must be a resource with access to the container session. Modify as needed to match the location of your external interface (see the documentation on flow redirects).
You may also dynamically derive the path to use, typically so that it can vary based on aspects of the request, by defining a bean named shibboleth.authn.External.externalAuthnPathStrategy of type Function<ProfileRequestContext,String>.
The shibboleth.authn.External.ClassifiedMessageMap is a map of exception/error messages to classified error conditions. You can make use of this map either by modifying it to understand the error or exception messages returned by your external code.
API
The ExternalAuthentication class makes up the interface between the external code and the IdP. The general flow is:
Call ExternalAuthentication.startExternalAuthentication(HttpServletRequest), saving off the result as a key.
Do work as necessary (reading request details from the attributes below). Any redirects must preserve the key value returned in step 1 because it must be used to complete the login later.
Set request attributes to communicate the result of the login back.
Call ExternalAuthentication.finishExternalAuthentication(String, HttpServletRequest, HttpServletResponse). The first parameter is the key returned in step 1.
Example JSP implementations are below.
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Inputs
On first access to the external resource, the request attributes below will be set.
...
Name
...
Type
...
Function
...
opensamlProfileRequestContext
...
...
Access to full request context tree
...
forceAuthn
...
Boolean
...
Whether the requester asked for re-authentication
...
isPassive
...
Boolean
...
Whether the requested asked for passive authentication
...
relyingParty
...
String
...
Name of the relying party requesting authentication
...
extended
...
Boolean
...
Whether this login flow has been invoked as an extension of another login flow
Outputs
...
Name
...
Type
...
Function
...
principalName
...
String
...
Name of authenticated subject to use as the login result
...
principal
...
...
Java Principal object to use as the login result
...
subject
...
...
Java Subject object to use as the login result
...
authnError
...
String
...
Error message to return in place of a successful login
...
authnException
...
Exception
...
Explicit exception object to return in place of a successful login
...
authnInstant
...
...
Exact time of authentication to report back
...
authnAuthorities
...
Collection<String>
...
Ordered collection of URIs identifying upstream/proxied authenticating "authorities" used to authenticate the subject
...
attributes
...
Collection<IdPAttribute>
...
Collection of IdPAttribute objects to associate with the authenticated subject
...
doNotCache
...
Boolean
...
If true, prevents the result from being saved for future use for SSO
...
previousResult
...
Boolean
...
If true, the "new" AuthenticationResult is created with the "previousResult" flag set to true (mainly impacts auditing)
Only one "result" or error attribute should be set by the external code. Setting more than one has unspecified behavior. In most cases, the simple principalName should be returned on success, but you can return the more complex objects to pass back additional information such as public or private credentials or custom principal data.
Any IdPAttribute objects supplied will be processed by the AttributeFilter service as "inbound" data. If at least one value in the "authnAuthorities" attribute is supplied, it is set as the "issuer" of the attributes for the purposes of the filter evaluation.
Note that returning a Subject is often paired with setting the shibboleth.authn.External.addDefaultPrincipals bean (V4.0) or idp.authn.External.addDefaultPrincipals property (V4.1+) to false, to dynamically establish Principal(s) representing the authentication method used without having them overwritten.
For example, your External flow's supportedPrincipals
property might be defined to include both password and multi-factor authentication Principals (meaning it supports both methods), but you can return the specific method used at runtime in the Subject. For SAML 2.0, this is typically done (programmatically) by using the net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal class with the appropriate value from the standard or a deployment. Other classes in that package address SAML 1.1 and unusual SAML 2.0 use cases. For the built-in constants defined by the standard, there are Java constants available via org.opensaml.saml.saml2.core.AuthnContext.
Reference
Expand | ||
---|---|---|
| ||
Bean ID / Type | Default | Description |
shibboleth.authn.External.externalAuthnPath | contextRelative:external.jsp | Spring Web Flow redirection expression for the protected resource | shibboleth.authn.External.externalAuthnPathStrategy | Optional function that returns the redirection expression to use for the protected resource |
shibboleth.authn.External.ClassifiedMessageMap | (see file) | A map between defined error/warning conditions and events and implementation-specific message fragments to map to them. | shibboleth.authn.External.resultCachingPredicate | Optional bean that can be defined to control whether to preserve the authentication result in an IdP session |
shibboleth.authn.External.addDefaultPrincipals | true | Whether to add the content of the | shibboleth.authn.External.matchExpression | Regular expression to match username against |
Expand | ||
| ||
The beans defined, or expected to be defined, in authn/external-authn-config
|
Inputs
On first access to the external resource, the request attributes below will be set.
Name | Type | Function |
---|---|---|
opensamlProfileRequestContext | Access to full request context tree | |
forceAuthn | Boolean | Whether the requester asked for re-authentication |
isPassive | Boolean | Whether the requested asked for passive authentication |
relyingParty | String | Name of the relying party requesting authentication |
Outputs
Name | Type | Function |
---|---|---|
principalName | String | Name of authenticated subject to use as the login result |
principal | Java Principal object to use as the login result | |
subject | Java Subject object to use as the login result | |
authnError | String | Error message to return in place of a successful login |
authnException | Exception | Explicit exception object to return in place of a successful login |
authnInstant | Exact time of authentication to report back | |
authnAuthorities | Collection<String> | Ordered collection of URIs identifying upstream/proxied authenticating "authorities" used to authenticate the subject |
attributes | Collection<IdPAttribute> | Collection of IdPAttribute objects to associate with the authenticated subject |
doNotCache | Boolean | If true, prevents the result from being saved for future use for SSO |
previousResult | Boolean | If true, the "new" AuthenticationResult is created with the "previousResult" flag set to true (mainly impacts auditing) |
Only one "result" or error attribute should be set by the external code. Setting more than one has unspecified behavior. In most cases, a simple principalName should be returned on success, but you can return the more complex objects to pass back additional information such as public or private credentials or custom principal data.
Any IdPAttribute objects supplied will be processed by the AttributeFilter service as "inbound" data. If at least one value in the "authnAuthorities" attribute is supplied, it is set as the "issuer" of the attributes for the purposes of the filter evaluation.
Note that returning a Subject is often paired with setting the idp.authn.External.addDefaultPrincipals property to false, to dynamically establish Principal(s) representing the authentication method used without having them overwritten.
For example, your External flow's supportedPrincipals
property might be defined to include both password and multi-factor authentication Principals (meaning it supports both methods), but you can return the specific method used at runtime in the Subject. For SAML 2.0, this is typically done (programmatically) by using the net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal class with the appropriate value from the standard or a deployment. Other classes in that package address SAML 1.1 and unusual SAML 2.0 use cases. For the built-in constants defined by the standard, there are Java constants available via org.opensaml.saml.saml2.core.AuthnContext.
Reference
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Beans that may be defined in global.xml follow:
|
Expand | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The flow-specific properties usable via authn/authn.properties are:
The general properties configuring this flow via authn/authn.properties are:
Most of the flows, including this one, default to describing themselves in terms of "password"-based authentication, so the
In property form, this is expressed as (note especially the trailing commas, which MUST be there):
|
Expand | |||||
---|---|---|---|---|---|
| |||||
To replace the internally defined flow descriptor bean, the following XML is required:
In older versions and upgraded systems, this list is defined in conf/authn/general-authn.xml. In V4.1+V5, no default version of the list is provided and it may simply be placed in conf/global.xml if needed. |
Notes
Note that upgraded systems will have alternate, legacy approaches to configuring this feature, as noted above.