...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
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.
Advanced Topics
Custom Events
TBD, for now refer to the same material in the Password login flow documentation.The API supports the signaling of custom errors and exceptions. The main purpose of this feature is to support the signalling of custom events from the login flow by mapping these errors into custom Web Flow events that become the result of the login flow, and can be handled either via MFA scripting or used to control eventual error handling within the IdP.
The actual handling of custom events is discussed in the AuthenticationConfigurationtopic. To actually signal such an event, you need to utilize the so-called “classified message map” feature that is common to a number of login flows.
The input to the mapping process comes from the output attributes defined in the API above, either “authnError” or “authnException”. The value of the former, or the exception message contained in the latter, is the input string. The output of the mapping process is the event you want to signal. If you completely control the input value because you are creating it yourself in your code, then the simplest thing to do is simply use the desired event as the “authnError” value. However, you still need to create the mapping bean because the IdP doesn’t know this is the event you want to signal.
The mapping process is controlled by a map bean you must create, named shibboleth.authn.External.ClassifiedMessageMap, typically in global.xml. The map keys are the event(s) you want to signal, and the map values are a list of strings to test the input values against to produce that event. In the simplest case, these can be the same thing. The matching is by substring so if any part of the map’s values are found in the input string, it will map to that entry’s key.
For example, if you want to use an “authnError” value of “MyCustomEvent” or trap an exception message containing the string “Error message you don’t control”, your map would look like this:
Code Block | ||
---|---|---|
| ||
<util:map id="shibboleth.authn.External.ClassifiedMessageMap">
<entry key="MyCustomEvent">
<list>
<value>MyCustomEvent</value>
<value>Error message you don't control</value>
</list>
</entry>
</util:map> |
Reference
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Beans that may be defined in global.xml follow:
|
...