Skip to content

Commit 9660b00

Browse files
committed
New release 0.1.1
Improve README
1 parent 099839d commit 9660b00

File tree

8 files changed

+79
-15
lines changed

8 files changed

+79
-15
lines changed

README.md

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ The goal of this project is to provide a simple OAuth2 library which can be impl
44

55
Configuring the oauth2 server for any framework should be simple and understandable.
66
It encourages to adapt to existing implementations instead the other way around.
7-
## Frameworks
8-
### Ktor
9-
Setup
7+
# Maven
8+
Include the following repository in order to download the artifacts
109
```xml
1110
<repositories>
1211
<repository>
@@ -15,6 +14,17 @@ Setup
1514
</repository>
1615
</repositories>
1716
```
17+
18+
Setting the version in properties
19+
```xml
20+
<properties>
21+
<myndocs.oauth.version>0.1.1</myndocs.oauth.version>
22+
</properties>
23+
```
24+
# Frameworks
25+
## Ktor
26+
Include the following dependencies
27+
1828
```xml
1929
<dependency>
2030
<groupId>nl.myndocs</groupId>
@@ -48,7 +58,7 @@ Setup
4858
</dependency>
4959
```
5060

51-
Basic setup for Ktor:
61+
In memory example for Ktor:
5262
```kotlin
5363
embeddedServer(Netty, 8080) {
5464
install(Oauth2ServerFeature) {
@@ -69,8 +79,62 @@ embeddedServer(Netty, 8080) {
6979
}.start(wait = true)
7080
```
7181

72-
## Custom implementation
73-
### Identity service
82+
## Javalin
83+
Include the following dependencies
84+
```xml
85+
<dependency>
86+
<groupId>nl.myndocs</groupId>
87+
<artifactId>kotlin-oauth2-server-core</artifactId>
88+
<version>${myndocs.oauth.version}</version>
89+
</dependency>
90+
<dependency>
91+
<groupId>nl.myndocs</groupId>
92+
<artifactId>kotlin-oauth2-server-client-inmemory</artifactId>
93+
<version>${myndocs.oauth.version}</version>
94+
</dependency>
95+
<dependency>
96+
<groupId>nl.myndocs</groupId>
97+
<artifactId>kotlin-oauth2-server-javalin</artifactId>
98+
<version>${myndocs.oauth.version}</version>
99+
</dependency>
100+
<dependency>
101+
<groupId>nl.myndocs</groupId>
102+
<artifactId>kotlin-oauth2-server-identity-inmemory</artifactId>
103+
<version>${myndocs.oauth.version}</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>nl.myndocs</groupId>
107+
<artifactId>kotlin-oauth2-server-token-store-inmemory</artifactId>
108+
<version>${myndocs.oauth.version}</version>
109+
</dependency>
110+
```
111+
112+
In memory example for Javalin:
113+
```kotlin
114+
Javalin.create().apply {
115+
enableOauthServer {
116+
identityService = InMemoryIdentity()
117+
.identity {
118+
username = "foo"
119+
password = "bar"
120+
}
121+
122+
clientService = InMemoryClient()
123+
.client {
124+
clientId = "testapp"
125+
clientSecret = "testpass"
126+
scopes = setOf("ROLE_CLIENT")
127+
redirectUris = setOf("https://localhost:7000/callback")
128+
}
129+
130+
tokenStore = InMemoryTokenStore()
131+
132+
accessTokenConverter = UUIDAccessTokenConverter(1)
133+
}
134+
}.start(7000)
135+
```
136+
# Custom implementation
137+
## Identity service
74138
Users can be authenticate through the identity service. In OAuth2 terms this would be the resource owner.
75139

76140
```kotlin
@@ -84,7 +148,7 @@ fun validScopes(forClient: Client, identity: Identity, scopes: Set<String>): Boo
84148
Each of the methods that needs to be implemented contains `Client`. This could give you extra flexibility.
85149
For example you could have user base per client, instead of have users over all clients.
86150

87-
### Client service
151+
## Client service
88152
Client service is similar to the identity service.
89153

90154
```kotlin
@@ -93,7 +157,7 @@ fun clientOf(clientId: String): Client?
93157
fun validClient(client: Client, clientSecret: String): Boolean
94158
```
95159

96-
### Token store
160+
## Token store
97161
The following methods have to be implemented for a token store.
98162

99163
```kotlin

kotlin-oauth2-server-client-inmemory/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kotlin-oauth2-server-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kotlin-oauth2-server-identity-inmemory/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kotlin-oauth2-server-javalin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kotlin-oauth2-server-ktor/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kotlin-oauth2-server-token-store-inmemory/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kotlin-oauth2-server</artifactId>
77
<groupId>nl.myndocs</groupId>
8-
<version>0.1.0</version>
8+
<version>0.1.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>nl.myndocs</groupId>
88
<artifactId>kotlin-oauth2-server</artifactId>
99
<packaging>pom</packaging>
10-
<version>0.1.0</version>
10+
<version>0.1.1</version>
1111

1212
<properties>
1313
<kotlin.version>1.2.60</kotlin.version>

0 commit comments

Comments
 (0)