Class Saml2LoginConfigurer

java.lang.Object
com.codename1.backend.security.SecurityConfigurer
com.codename1.backend.security.Saml2LoginConfigurer

public final class Saml2LoginConfigurer extends SecurityConfigurer

Sign-in through a SAML 2.0 identity provider: Okta, Microsoft Entra ID, ADFS, Ping, Google Workspace, Keycloak, Shibboleth.

http.authorizeHttpRequests(auth -> auth.anyRequest().authenticated())
    .saml2Login(Customizer.withDefaults());

with, in application.properties,

cn1.security.saml2.relyingparty.registration.okta.assertingparty.metadata-uri=https://...

The identity providers are the application's RelyingPartyRegistrationRepository bean or the registrations the configuration declares; see RelyingPartyRegistrations.

A sign-in starts at GET /saml2/authenticate/{registrationId}, which sends the browser to the identity provider with an AuthnRequest, and ends at POST /login/saml2/sso/{registrationId}, where the identity provider posts its response. This server's metadata, for the identity provider's administrator, is at GET /saml2/service-provider-metadata/{registrationId}. How a response is judged is Saml2ResponseValidator's; who the user is here is the authenticationConverter(Saml2AuthenticationConverter)'s, which by default gives every signed-in user ROLE_USER.

An assertion encrypted to a registration's decryption credential is decrypted; see RelyingPartyRegistration.Builder.decryptionCredential(byte[], Certificate). Signing out ends the session here only, unless http.saml2Logout(...) is declared as well; see Saml2LogoutConfigurer.

The cookie that holds a pending request is signed with cn1.security.saml2.cookie-secret (at least 32 characters); unset, a key is made per process, and a response that reaches another server than the one that sent the request is then taken as unsolicited -- set it when several servers share the work.