Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
.settings/
target/
.DS_Store
.classpath
.project
dependency-reduced-pom.xml
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Apache Oltu OAuth 2.0 Client and Provider

--------------------

The OAuth 2.0 client and identity provider are built based on open-source Apache Oltu OAuth 2.0 source repository which only consists of OAuth 2.0 client demo application.

The OAuth 2.0 identity provider demo application has been developed to illustrate the OAuth 2.0 authorization flow and provide instructions on how to develop a standalone OAuth 2.0 server using Apache Oltu OAuth 2.0 library.

Installation
------------
+ Download the source repository from GitHub.
```
git clone https://github.com/winstonhong/oltu
```
+ Build OAuth 2.0 library from Apache Oltu source code.
```
cd oltu
mvn clean
mvn package
```
+ Run OAuth 2.0 client demo application
```
cd oltu/demos/client-demo/
mvn jetty:run
```
+ Run OAuth 2.0 identity provider demo application
```
cd oltu/demos/provider-demo/
mvn jetty:run
```

OAuth 2.0 Authorization Demo
------------
+ Access the link "http://localhost:8080" to launch the OAuth 2.0 authorization demo
+ Click **Generic OAuth2 Application**
+ Input **End-User Authorization URL** : http://localhost:9001/auth/oauth2/authz , <br>
input **Token Endpoint** : http://localhost:9001/auth/oauth2/token , <br>
input **Client ID** : clinet_id , <br>
input **Client Secret** : clinet_secret , <br>
and then click **Get Authorization**
+ Input **Username/Password** : username/password , <br>
and then click **Login**
+ Click **Grant permission**
+ Click **Get Token**
+ Input **Resource URL** : http://localhost:9001/auth/oauth2/resource_server/resource_query ,<br>
select **queryParameter** from the drop-down list of **Authenticated Request Type**, <br>
and then click **Get Resource** to retrieve User Info.


References
-------
Apache Oltu https://oltu.apache.org/

OAuthh 2.0 libraries https://oauth.net/code/

Support
-------
OAuth 2.0 identity provider developed by [winstonhong](https://github.com/winstonhong) @ [inbaytech](https://github.com/inbaytech)
1 change: 1 addition & 0 deletions demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<modules>
<module>client-demo</module>
<module>provider-demo</module>
</modules>

</project>
315 changes: 315 additions & 0 deletions demos/provider-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.oltu.demos</groupId>
<artifactId>org.apache.oltu.demos.parent</artifactId>
<version>1-SNAPSHOT</version>
</parent>

<artifactId>org.apache.oltu.demos.provider</artifactId>
<packaging>war</packaging>

<name>Apache Oltu - Demos - Provider</name>

<properties>
<oltu.oauth2.version>1.0.2</oltu.oauth2.version>
<oltu.oauth2.jwt.version>1.0.4-SNAPSHOT</oltu.oauth2.jwt.version>
<oltu.oidc.version>0.0.1-SNAPSHOT</oltu.oidc.version>
<cxf.version>2.2.10</cxf.version>
<org.springframework.version>4.3.22.RELEASE</org.springframework.version>
<spring-mock.version>2.0.8</spring-mock.version>
<easy-mock.version>3.0</easy-mock.version>
<servlet-api.version>2.5</servlet-api.version>
<jetty.version>7.1.5.v20100705</jetty.version>
<pmd.version>2.5</pmd.version>
<jersey-server.version>1.8</jersey-server.version>
<slf4j.version>1.7.25</slf4j.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.7.25</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>

<!-- OAuth Dependency -->
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.common</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.authzserver</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.httpclient4</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.resourceserver</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<!-- OAuth Dynamic Registration Dependency -->

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.dynamicreg.client</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.dynamicreg.common</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.dynamicreg.server</artifactId>
<version>${oltu.oauth2.version}</version>
</dependency>


<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.jwt</artifactId>
<version>${oltu.oauth2.jwt.version}</version>
</dependency>

<!-- OpenId Connect Dependency -->
<dependency>
<groupId>org.apache.oltu.openidconnect</groupId>
<artifactId>org.apache.oltu.openidconnect.common</artifactId>
<version>${oltu.oidc.version}</version>
</dependency>

<dependency>
<groupId>org.apache.oltu.openidconnect</groupId>
<artifactId>org.apache.oltu.openidconnect.client</artifactId>
<version>${oltu.oidc.version}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-server.version}</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>${spring-mock.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>${easy-mock.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.22.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
<!-- <scope>test</scope>-->
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/resources/</directory>
</resource>
<resource>
<directory>${project.build.directory}/war-legals/</directory>
<targetPath>/META-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>

<!-- Generates the distribution package -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>prepare-package</id>
<phase>prepare-package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<finalName>war-legals</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${basedir}/src/main/assembly/prepare-war-legals.xml</descriptor>
</descriptors>
</configuration>
</execution>

<execution>
<id>release-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>${basedir}/src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.24</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9001</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading