0

I have a pac4j Config with two SAML2Client:

val clients = new Clients(baseUrl + "/domain/callback", samlClient1, samlClient2)
val config = new Config(clients)

My question:

How do I specify the client I want to use in a secure action if both clients are SAML2Client?

def SAMLSecure: SecureAction[SAML2Profile, AnyContent, AuthenticatedRequest] =
    Secure(
      clients = "SAML2Client", // How to specify samlClient1 or samlClient2
      authorizers = myAuthorizers,
      matchers = myMatchers
    )
epinal
  • 1,415
  • 1
  • 13
  • 27

1 Answers1

0

Found a solution.

val samlClient1 = new SAML2Client()
val samlClient2 = new SAML2Client()

samlClient1.setName("SamlClient1")
samlClient2.setName("SamlClient2")

val clients = new Clients(baseUrl + "/domain/callback", samlClient1, samlClient2)
val config = new Config(clients)

And then you can define the SecureAction like this:

def SAMLSecure: SecureAction[SAML2Profile, AnyContent, AuthenticatedRequest] =
    Secure(
      clients = "SamlClient1", // Or "SamlClient2" or both "SamlClient1,SamlClient2"
      authorizers = myAuthorizers,
      matchers = myMatchers
    )
epinal
  • 1,415
  • 1
  • 13
  • 27