Skip to content
Jérôme LELEU edited this page Oct 1, 2026 · 10 revisions

These instructions apply to play-pac4j 14.0.0, for Java and Scala applications.

Supported stack

Component Version
Java JDK 17 or later
Play 3.0 (built and tested with 3.0.12)
Scala 3.9.0 LTS
pac4j 6.5.9
play-pac4j 14.0.0

Version 14 publishes one artifact: org.pac4j:play-pac4j_3:14.0.0. It contains both Java and Scala APIs. There are no _2.12 or _2.13 artifacts for v14, and the version has no -PLAY3.0 suffix.

sbt

Use the Play 3.0.12 plugin in project/plugins.sbt:

addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.12")

In build.sbt, enable PlayJava or PlayScala as appropriate and configure:

scalaVersion := "3.9.0"

libraryDependencies ++= Seq(
  guice,
  "org.pac4j" %% "play-pac4j" % "14.0.0",
  ("org.pac4j" % "pac4j-oidc" % "6.5.9") // example: OpenID Connect
    .exclude("com.fasterxml.jackson.core", "jackson-databind")
)

The Scala setting is required for Java applications too: Play and play-pac4j include Scala APIs and metadata. With Scala 3, %% selects the _3 artifact. Use %, not %%, for pac4j's Java modules.

Choose the pac4j modules needed by your clients, for example pac4j-oidc, pac4j-oauth, pac4j-cas, pac4j-http or pac4j-ldap, and keep their versions aligned at 6.5.9.

Keep Play's Jackson modules aligned. In this Play 3.0.12 setup, apply the jackson-databind exclusion shown above to each additional pac4j module: pac4j 6.5.9 otherwise brings a newer databind alongside Play's older Jackson modules, which can fail at startup. The play-pac4j dependency already excludes databind on its own pac4j-core dependency.

Use Play's Guice dependency, which is Guice 6.0.0 for Play 3.0.12. Overriding it with Guice 7 breaks Play 3.0's javax.inject integration.

For PlayCacheSessionStore, also add a Play cache implementation, for example libraryDependencies += caffeine. See the Play cache documentation. PlayCookieSessionStore does not need a cache implementation.

Maven coordinates

If your application uses Maven, the play-pac4j dependency is:

<dependency>
  <groupId>org.pac4j</groupId>
  <artifactId>play-pac4j_3</artifactId>
  <version>14.0.0</version>
</dependency>

Apply the same exclusion to additional pac4j modules, for example:

<dependency>
  <groupId>org.pac4j</groupId>
  <artifactId>pac4j-oidc</artifactId>
  <version>6.5.9</version>
  <exclusions>
    <exclusion>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Your application must supply Play 3.0 and its required runtime modules; Play is a provided dependency of play-pac4j.

Released artifacts are available from Maven Central, without adding a snapshot resolver. For older Play or Scala versions, consult the historical compatibility table and migration guide.

Clone this wiki locally