Skip to content

Commit 1a028ee

Browse files
committed
initial implementation
1 parent 6b7c64e commit 1a028ee

File tree

11 files changed

+571
-0
lines changed

11 files changed

+571
-0
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Ignore Java project files #
2+
*.class
3+
*.jar
4+
*.war
5+
*.ear
6+
7+
**/target
8+
dependency-reduced-pom.xml
9+
10+
# Ignore IntelliJ project files #
11+
12+
*.iml
13+
*.ipr
14+
*.iws
15+
.idea/

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Fake OpenID Connect Authorization Server
2+
3+
(c) 2020 Martin Kuba, CESNET
4+
5+
This application implements an OpenID Connect (OIDC) Authorization Server (AS) that
6+
provides just one user. Its purpose is to provide a temporary OIDC AS that can be
7+
used after deployment of an OIDC client and an OIDC resource server to set them up before
8+
a real OIDC server is deployed.
9+
10+
This fake server has the following features:
11+
* it is implemented in Java as Spring Boot application
12+
* implements **Implicit Grant flow** (for JavaScript clients)
13+
* provides the following endpoints:
14+
* /.well-known/openid-configuration providing metadata
15+
* /jwks providing JSON Web Key Set for validating cryptographic signature of id_token
16+
* /authorize which uses HTTP Basic Auth for asking for username and password
17+
* /userinfo that provides data about the user
18+
* /introspection that provides access token introspection
19+
20+
Build and run it with:
21+
```bash
22+
mvn package
23+
24+
java -jar target/fake_oidc.jar
25+
```
26+
27+
By default the application runs at TCP port 8090, uses a self-signed certificate for localhost, and the only
28+
user has username "perun" and password "test". This can be changed by using command line options:
29+
30+
```bash
31+
java -jar target/fake_oidc.jar \
32+
--server.port=8100 \
33+
--server.ssl.key-store=mykeystore.p12 \
34+
--oidc.user.logname=john \
35+
--oidc.user.password=bflmpsvz \
36+
37+
--oidc.user.name="John Doe"
38+
```
39+
See all the available options in the file src/main/resources/application.yml
40+

pom.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.3.2.RELEASE</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>cz.metacentrum</groupId>
12+
<artifactId>fake_oidc</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<name>fake_oidc</name>
15+
<description>Fake OpenId Connect Authorization Server</description>
16+
17+
<properties>
18+
<java.version>11</java.version>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-web</artifactId>
25+
</dependency>
26+
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-test</artifactId>
30+
<scope>test</scope>
31+
<exclusions>
32+
<exclusion>
33+
<groupId>org.junit.vintage</groupId>
34+
<artifactId>junit-vintage-engine</artifactId>
35+
</exclusion>
36+
</exclusions>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>com.nimbusds</groupId>
41+
<artifactId>nimbus-jose-jwt</artifactId>
42+
<version>8.19</version>
43+
</dependency>
44+
</dependencies>
45+
46+
<build>
47+
<finalName>${project.name}</finalName>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-maven-plugin</artifactId>
52+
</plugin>
53+
</plugins>
54+
</build>
55+
56+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cz.metacentrum.fake_oidc;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class FakeOidcApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(FakeOidcApplication.class, args);
11+
}
12+
13+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package cz.metacentrum.fake_oidc;
2+
3+
import org.springframework.boot.context.properties.ConfigurationProperties;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
@ConfigurationProperties(prefix="oidc")
8+
public class FakeOidcProperties {
9+
10+
private User user;
11+
12+
public User getUser() {
13+
return user;
14+
}
15+
16+
public void setUser(User user) {
17+
this.user = user;
18+
}
19+
20+
@Override
21+
public String toString() {
22+
return "FakeOidcProperties{" +
23+
"user=" + user +
24+
'}';
25+
}
26+
}

0 commit comments

Comments
 (0)