Skip to content

Commit

Permalink
Updated implementation for newer versions of Tomcat 8.5 and 9.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
levahim committed Feb 2, 2020
1 parent 98279ff commit fd3e66f
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 117 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# OpenID Connect Authenticator for Tomcat

This is an authenticator implementation for [Apache Tomcat](http://tomcat.apache.org/) 9.0, 8.5 and 8.0 that allows web-applications to use [OpenID Connect](http://openid.net/connect/) to log users in.
This is an authenticator implementation for [Apache Tomcat](http://tomcat.apache.org/) 9.0 and 8.5 that allows web-applications to use [OpenID Connect](http://openid.net/connect/) to log users in.

References to Tomcat documenation in this manual link to Tomcat version 9.0. Corresponding pages for Tomcat 8.5 and 8.0 can be easily found on the Apache Tomcat website.
References to Tomcat documenation in this manual link to Tomcat version 9.0. Corresponding pages for Tomcat 8.5 can be easily found on the Apache Tomcat website.

A complete sample web-application is available at https://github.com/boylesoftware/tomcat-oidcauth-sample.

Expand Down Expand Up @@ -41,7 +41,7 @@ https://boylesoftware.com/maven/repo-os/org/bsworks/catalina/authenticator/oidc/

The JAR need to be added to the Tomcat's classpath, for example, by placing it in `$CATALINA_BASE/lib` directory (see Tomcat's [Class Loader How-To](https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html) for more info).

Tomcat versions 9.0 and 8.5 have slightly different interface for the authenticators compared to version 8.0. That is why there are binaries of the authenticator for each version of Tomcat. Make sure that you use one built for the correct Tomcat version.
There are separate binaries of the authenticator for Tomcat version 8.5 and 9.0. Make sure that you use one that's built for your version of Tomcat.

## Configuration

Expand All @@ -52,10 +52,10 @@ The authenticator is added to Tomcat configuration as a [Valve](https://tomcat.a
providers="..." />
```

For Tomcat 8.0 it will look like the following:
For Tomcat 8.5 it will look like the following:

```xml
<Valve className="org.bsworks.catalina.authenticator.oidc.tomcat80.OpenIDConnectAuthenticator"
<Valve className="org.bsworks.catalina.authenticator.oidc.tomcat85.OpenIDConnectAuthenticator"
providers="..." />
```

Expand Down
35 changes: 8 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ sourceCompatibility = '1.8'
targetCompatibility = '1.8'

group = 'org.bsworks.catalina.authenticator.oidc'
version = '2.2.5'
version = '2.3.0'

task jar(type: Jar, overwrite: true) {}
jar.enabled = false
javadoc.enabled = false

sourceSets {
mainTomcat80 {
java {
srcDirs = ['src/common/java', 'src/tomcat80/java']
}
}
mainTomcat85 {
java {
srcDirs = ['src/common/java', 'src/tomcat85/java']
Expand All @@ -36,7 +31,7 @@ sourceSets {
}

task compileJava(type: JavaCompile, overwrite: true) {
dependsOn compileMainTomcat80Java, compileMainTomcat85Java, compileMainTomcat90Java
dependsOn compileMainTomcat85Java, compileMainTomcat90Java
}

ext.sharedManifest = manifest {
Expand All @@ -47,13 +42,6 @@ ext.sharedManifest = manifest {
)
}

task mainTomcat80Jar(type: Jar) {
classifier = 'tomcat80'
from sourceSets.mainTomcat80.output
manifest = project.manifest {
from sharedManifest
}
}
task mainTomcat85Jar(type: Jar) {
classifier 'tomcat85'
from sourceSets.mainTomcat85.output
Expand All @@ -74,26 +62,20 @@ repositories {
}

dependencies {
mainTomcat80Implementation(
'org.apache.tomcat:tomcat-catalina:8.0.+',
'org.apache.tomcat:tomcat-juli:8.0.+',
'org.apache.tomcat:tomcat-util:8.0.+'
)
mainTomcat85Implementation(
'org.apache.tomcat:tomcat-catalina:8.5.+',
'org.apache.tomcat:tomcat-juli:8.5.+',
'org.apache.tomcat:tomcat-util:8.5.+'
'org.apache.tomcat:tomcat-catalina:[8.5.50,8.6.0)',
'org.apache.tomcat:tomcat-juli:[8.5.50,8.6.0)',
'org.apache.tomcat:tomcat-util:[8.5.50,8.6.0)'
)
mainTomcat90Implementation(
'org.apache.tomcat:tomcat-catalina:9.0.+',
'org.apache.tomcat:tomcat-juli:9.0.+',
'org.apache.tomcat:tomcat-util:9.0.+'
'org.apache.tomcat:tomcat-catalina:[9.0.30,9.1.0)',
'org.apache.tomcat:tomcat-juli:[9.0.30,9.1.0)',
'org.apache.tomcat:tomcat-util:[9.0.30,9.1.0)'
)
}

artifacts {
archives(
mainTomcat80Jar,
mainTomcat85Jar,
mainTomcat90Jar
)
Expand Down Expand Up @@ -134,7 +116,6 @@ publishing {
url = 'https://github.com/boylesoftware/tomcat-oidcauth/issues'
}
}
artifact mainTomcat80Jar
artifact mainTomcat85Jar
artifact mainTomcat90Jar
}
Expand Down
Loading

0 comments on commit fd3e66f

Please sign in to comment.