-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenID connect authentication module
- Loading branch information
Showing
24 changed files
with
979 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<!-- | ||
~ (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
~ This code is licensed under the GPL 2.0 license, available at the root | ||
~ application directory. | ||
~ | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.geoserver.community</groupId> | ||
<artifactId>gs-security</artifactId> | ||
<version>2.14-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.geoserver.community</groupId> | ||
<artifactId>gs-sec-oauth2-openid-connect</artifactId> | ||
<packaging>jar</packaging> | ||
<version>2.14-SNAPSHOT</version> | ||
<name>GeoServer OAuth2 Connect Security Module - OpenId Connect</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.geoserver</groupId> | ||
<artifactId>gs-main</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.geoserver.web</groupId> | ||
<artifactId>gs-web-sec-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.geoserver.community</groupId> | ||
<artifactId>gs-sec-oauth2</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.security.oauth</groupId> | ||
<artifactId>spring-security-oauth2</artifactId> | ||
<version>2.0.11.RELEASE</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.sf.json-lib</groupId> | ||
<artifactId>json-lib</artifactId> | ||
<classifier>jdk15</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-mapper-asl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.geoserver.community</groupId> | ||
<artifactId>gs-sec-oauth2</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.geoserver</groupId> | ||
<artifactId>gs-main</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.geoserver</groupId> | ||
<artifactId>gs-wms</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.geoserver.web</groupId> | ||
<artifactId>gs-web-core</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.geoserver.web</groupId> | ||
<artifactId>gs-web-sec-core</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>xmlunit</groupId> | ||
<artifactId>xmlunit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.easymock</groupId> | ||
<artifactId>easymock</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.easymock</groupId> | ||
<artifactId>easymockclassextension</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
23 changes: 23 additions & 0 deletions
23
...onnect/src/main/java/org/geoserver/security/oauth2/OpenIdConnectAuthenticationFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
* | ||
*/ | ||
package org.geoserver.security.oauth2; | ||
|
||
import org.geoserver.security.config.SecurityNamedServiceConfig; | ||
import org.springframework.security.oauth2.client.OAuth2RestOperations; | ||
import org.springframework.security.oauth2.provider.token.RemoteTokenServices; | ||
|
||
/** OpenID Connect authentication filter. */ | ||
public class OpenIdConnectAuthenticationFilter extends GeoServerOAuthAuthenticationFilter { | ||
|
||
public OpenIdConnectAuthenticationFilter( | ||
SecurityNamedServiceConfig config, | ||
RemoteTokenServices tokenServices, | ||
GeoServerOAuth2SecurityConfiguration oauth2SecurityConfiguration, | ||
OAuth2RestOperations oauth2RestTemplate) { | ||
super(config, tokenServices, oauth2SecurityConfiguration, oauth2RestTemplate); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...nect/src/main/java/org/geoserver/security/oauth2/OpenIdConnectAuthenticationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
* | ||
*/ | ||
package org.geoserver.security.oauth2; | ||
|
||
import org.geoserver.config.util.XStreamPersister; | ||
import org.geoserver.security.GeoServerSecurityManager; | ||
import org.geoserver.security.config.SecurityNamedServiceConfig; | ||
import org.geoserver.security.filter.GeoServerSecurityFilter; | ||
|
||
public class OpenIdConnectAuthenticationProvider extends GeoServerOAuthAuthenticationProvider { | ||
|
||
public OpenIdConnectAuthenticationProvider( | ||
GeoServerSecurityManager securityManager, | ||
String tokenServices, | ||
String oauth2SecurityConfiguration, | ||
String geoServerOauth2RestTemplate) { | ||
super( | ||
securityManager, | ||
tokenServices, | ||
oauth2SecurityConfiguration, | ||
geoServerOauth2RestTemplate); | ||
} | ||
|
||
@Override | ||
public void configure(XStreamPersister xp) { | ||
xp.getXStream().alias("openIdConnectAuthentication", OpenIdConnectFilterConfig.class); | ||
} | ||
|
||
@Override | ||
public Class<? extends GeoServerSecurityFilter> getFilterClass() { | ||
return OpenIdConnectAuthenticationFilter.class; | ||
} | ||
|
||
@Override | ||
public GeoServerSecurityFilter createFilter(SecurityNamedServiceConfig config) { | ||
return new OpenIdConnectAuthenticationFilter( | ||
config, tokenServices, oauth2SecurityConfiguration, geoServerOauth2RestTemplate); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...openid-connect/src/main/java/org/geoserver/security/oauth2/OpenIdConnectFilterConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
* | ||
*/ | ||
package org.geoserver.security.oauth2; | ||
|
||
/** | ||
* Filter configuration for OpenId Connect. This is completely freeform, so adding only the basic | ||
* bits in here. | ||
*/ | ||
public class OpenIdConnectFilterConfig extends GeoServerOAuth2FilterConfig { | ||
|
||
public OpenIdConnectFilterConfig() { | ||
this.redirectUri = "http://localhost:8080/geoserver"; | ||
this.scopes = "user"; | ||
this.enableRedirectAuthenticationEntryPoint = false; | ||
this.forceAccessTokenUriHttps = true; | ||
this.forceUserAuthorizationUriHttps = true; | ||
this.loginEndpoint = "/j_spring_oauth2_openid_connect_login"; | ||
this.logoutEndpoint = "/j_spring_oauth2_openid_connect_logout"; | ||
}; | ||
} |
Oops, something went wrong.