SamlWebFilter: Adapt to pac4j version 3.4 Pac4J and its dependencies are not available on Maven Central. However, recent builds can be found on the Schibboleth Consortium (see https://www.shibboleth.net/) Change-Id: I2fcf629fe8a6cf6ea4ba9c9e9fb411532960f9a8
diff --git a/build.sbt b/build.sbt index 5648170..bb25ffc 100644 --- a/build.sbt +++ b/build.sbt
@@ -10,7 +10,9 @@ libraryDependencies += ("com.google.gerrit" % "gerrit-plugin-api" % GerritVersion % "provided") -libraryDependencies += "org.pac4j" % "pac4j-saml" % "2.0.0-RC1" +libraryDependencies += "org.pac4j" % "pac4j-saml" % "3.4.0" + +resolvers += "Shibboleth" at "https://build.shibboleth.net/nexus/content/repositories/releases/" libraryDependencies ~= { _ map { case m => m
diff --git a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java index 1550703..cef774a 100644 --- a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java +++ b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
@@ -43,6 +43,7 @@ import org.pac4j.saml.client.SAML2ClientConfiguration; import org.pac4j.saml.credentials.SAML2Credentials; import org.pac4j.saml.profile.SAML2Profile; +import org.pac4j.saml.state.SAML2StateGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -179,7 +180,9 @@ .getRequest() .getRequestURI() .substring(context.getRequest().getContextPath().length())); - context.setSessionAttribute(SAML2Client.SAML_RELAY_STATE_ATTRIBUTE, redirectUri); + context + .getSessionStore() + .set(context, SAML2StateGenerator.SAML_RELAY_STATE_ATTRIBUTE, redirectUri); log.debug("Setting redirectUri: {}", redirectUri); saml2Client.redirect(context); }