我有一个pac4j Config和两个SAML2Client
val clients = new Clients(baseUrl + "/domain/callback", samlClient1, samlClient2)
val config = new Config(clients)我的问题是:
如果两个客户端都是SAML2Client,如何指定要在安全操作中使用的客户机?
def SAMLSecure: SecureAction[SAML2Profile, AnyContent, AuthenticatedRequest] =
Secure(
clients = "SAML2Client", // How to specify samlClient1 or samlClient2
authorizers = myAuthorizers,
matchers = myMatchers
)发布于 2022-09-02 17:50:24
找到了解决办法。
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)然后您可以像这样定义SecureAction:
def SAMLSecure: SecureAction[SAML2Profile, AnyContent, AuthenticatedRequest] =
Secure(
clients = "SamlClient1", // Or "SamlClient2" or both "SamlClient1,SamlClient2"
authorizers = myAuthorizers,
matchers = myMatchers
)https://stackoverflow.com/questions/73295619
复制相似问题