Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Saml2Logout

  1. Object
  2. Saml2Logout

SAML Single Logout, front channel: the LogoutRequest and LogoutResponse this server sends, and the checks on the ones it receives.

Every logout message is signed both ways. One this server sends is signed with the registration’s signing key, so a registration without one cannot take part in Single Logout; one it receives must carry a signature that verifies under the identity provider’s certificates – in the query for the HTTP-Redirect binding, enveloped in the XML for HTTP-POST. An unsigned logout request is refused, since anyone could otherwise end anyone’s session.

SOAP (back channel) logout is not supported, as it is not by Spring Security.

Nested types

class Saml2Logout.ReceivedA logout message this server received, after every check passed.

Fields

public static final String SUCCESS = "urn:oasis:names:tc:SAML:2.0:status:Success"urn:oasis:names:tc:SAML:2.0:status:Success.
public static final String REQUESTER = "urn:oasis:names:tc:SAML:2.0:status:Requester"The status of an answer to a request that names someone else.

Methods

public static Saml2Message request(RelyingPartyRegistration registration, Saml2AuthenticatedPrincipal principal, String entityId, String relayState, long now) throws IOExceptionThe LogoutRequest that ends principal’s session at the identity provider.
public static Saml2Message response(RelyingPartyRegistration registration, String inResponseTo, String status, String entityId, String relayState, long now) throws IOExceptionThe LogoutResponse answering the identity provider’s request inResponseTo.
public static Saml2Logout.Received readRedirect(RelyingPartyRegistration registration, String rawQuery, String sloLocation, long now)Reads and checks a logout message that arrived by HTTP-Redirect.
public static Saml2Logout.Received readPost(RelyingPartyRegistration registration, String parameter, String value, String relayState, String sloLocation, long now)Reads and checks a logout message that arrived by HTTP-POST.

Inherited methods

Field details

SUCCESS

public static final String SUCCESS = "urn:oasis:names:tc:SAML:2.0:status:Success"
urn:oasis:names:tc:SAML:2.0:status:Success.

REQUESTER

public static final String REQUESTER = "urn:oasis:names:tc:SAML:2.0:status:Requester"
The status of an answer to a request that names someone else.

Method details

request

public static Saml2Message request(RelyingPartyRegistration registration, Saml2AuthenticatedPrincipal principal, String entityId, String relayState, long now) throws IOException
The LogoutRequest that ends principal’s session at the identity provider.

Parameters

registration RelyingPartyRegistration
Not documented.
principal Saml2AuthenticatedPrincipal
Not documented.
entityId String
this server’s entity ID, resolved
relayState String
Not documented.
now long
Not documented.

Throws

IllegalStateException
when the registration has no logout address or no signing key
IOException

response

public static Saml2Message response(RelyingPartyRegistration registration, String inResponseTo, String status, String entityId, String relayState, long now) throws IOException
The LogoutResponse answering the identity provider’s request inResponseTo.

Parameters

registration RelyingPartyRegistration
Not documented.
inResponseTo String
Not documented.
status String
SUCCESS, or another status code
entityId String
Not documented.
relayState String
Not documented.
now long
Not documented.

readRedirect

public static Saml2Logout.Received readRedirect(RelyingPartyRegistration registration, String rawQuery, String sloLocation, long now)
Reads and checks a logout message that arrived by HTTP-Redirect.

Parameters

registration RelyingPartyRegistration
Not documented.
rawQuery String
the query exactly as it arrived, still percent encoded: the signature is over those bytes
sloLocation String
this server’s logout address for the registration, resolved
now long
Not documented.

Throws

Saml2AuthenticationException
when it is refused

readPost

public static Saml2Logout.Received readPost(RelyingPartyRegistration registration, String parameter, String value, String relayState, String sloLocation, long now)
Reads and checks a logout message that arrived by HTTP-POST.

Parameters

registration RelyingPartyRegistration
Not documented.
parameter String
SAMLRequest or SAMLResponse
value String
the posted parameter, base64
relayState String
Not documented.
sloLocation String
Not documented.
now long
Not documented.

Throws

Saml2AuthenticationException
when it is refused