Pac4jAuthenticationAdapter
works.iterative.server.http.impl.pac4j.Pac4jAuthenticationAdapter
object Pac4jAuthenticationAdapter extends AuthenticationService
Adapter that bridges Pac4J authentication to ZIO AuthenticationService.
This adapter:
- Maps Pac4J CommonProfile (Java) to BasicProfile (Scala/ZIO)
- Handles null values defensively with Option
- Stores user context in FiberRef for request-scoped authentication
- Extracts roles from Pac4J profile attributes
Example usage:
// After Pac4J successful authentication with CommonProfile
val profile: CommonProfile = ... // from Pac4J
val token = AccessToken("oauth-token-123")
for
adapter <- ZIO.service[AuthenticationService]
basicProfile = Pac4jAuthenticationAdapter.mapProfile(profile)
_ <- adapter.loggedIn(token, basicProfile)
currentUser <- adapter.currentUserInfo
yield currentUser // Some(AuthedUserInfo(...))
Attributes
- Graph
-
- Supertypes
-
trait AuthenticationServiceclass Objecttrait Matchableclass Any
- Self type
Members list
In this article