-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from myndocs/release/0.4.0
Release/0.4.0
- Loading branch information
Showing
39 changed files
with
989 additions
and
750 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# http4k | ||
|
||
## Dependencies | ||
```xml | ||
<dependency> | ||
<groupId>nl.myndocs</groupId> | ||
<artifactId>oauth2-server-http4k</artifactId> | ||
<version>${myndocs.oauth.version}</version> | ||
</dependency> | ||
``` | ||
|
||
## Implementation | ||
```kotlin | ||
val app: HttpHandler = routes( | ||
"/ping" bind GET to { _: Request -> Response(Status.OK).body("pong!") } | ||
) `enable oauth2` { | ||
identityService = InMemoryIdentity() | ||
.identity { | ||
username = "foo" | ||
password = "bar" | ||
} | ||
clientService = InMemoryClient() | ||
.client { | ||
clientId = "testapp" | ||
clientSecret = "testpass" | ||
scopes = setOf("trusted") | ||
redirectUris = setOf("http://localhost:8080/callback") | ||
authorizedGrantTypes = setOf( | ||
AuthorizedGrantType.AUTHORIZATION_CODE, | ||
AuthorizedGrantType.PASSWORD, | ||
AuthorizedGrantType.IMPLICIT, | ||
AuthorizedGrantType.REFRESH_TOKEN | ||
) | ||
} | ||
tokenStore = InMemoryTokenStore() | ||
} | ||
|
||
app.asServer(Jetty(9000)).start() | ||
``` |
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,37 @@ | ||
# Javalin | ||
|
||
## Dependencies | ||
```xml | ||
<dependency> | ||
<groupId>nl.myndocs</groupId> | ||
<artifactId>oauth2-server-javalin</artifactId> | ||
<version>${myndocs.oauth.version}</version> | ||
</dependency> | ||
``` | ||
|
||
## Implementation | ||
```kotlin | ||
Javalin.create().apply { | ||
enableOauthServer { | ||
identityService = InMemoryIdentity() | ||
.identity { | ||
username = "foo" | ||
password = "bar" | ||
} | ||
clientService = InMemoryClient() | ||
.client { | ||
clientId = "testapp" | ||
clientSecret = "testpass" | ||
scopes = setOf("trusted") | ||
redirectUris = setOf("https://localhost:7000/callback") | ||
authorizedGrantTypes = setOf( | ||
AuthorizedGrantType.AUTHORIZATION_CODE, | ||
AuthorizedGrantType.PASSWORD, | ||
AuthorizedGrantType.IMPLICIT, | ||
AuthorizedGrantType.REFRESH_TOKEN | ||
) | ||
} | ||
tokenStore = InMemoryTokenStore() | ||
} | ||
}.start(7000) | ||
``` |
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,38 @@ | ||
# Ktor | ||
|
||
## Dependencies | ||
|
||
```xml | ||
<dependency> | ||
<groupId>nl.myndocs</groupId> | ||
<artifactId>oauth2-server-ktor</artifactId> | ||
<version>${myndocs.oauth.version}</version> | ||
</dependency> | ||
``` | ||
|
||
## Implementation | ||
```kotlin | ||
embeddedServer(Netty, 8080) { | ||
install(Oauth2ServerFeature) { | ||
identityService = InMemoryIdentity() | ||
.identity { | ||
username = "foo" | ||
password = "bar" | ||
} | ||
clientService = InMemoryClient() | ||
.client { | ||
clientId = "testapp" | ||
clientSecret = "testpass" | ||
scopes = setOf("trusted") | ||
redirectUris = setOf("https://localhost:8080/callback") | ||
authorizedGrantTypes = setOf( | ||
AuthorizedGrantType.AUTHORIZATION_CODE, | ||
AuthorizedGrantType.PASSWORD, | ||
AuthorizedGrantType.IMPLICIT, | ||
AuthorizedGrantType.REFRESH_TOKEN | ||
) | ||
} | ||
tokenStore = InMemoryTokenStore() | ||
} | ||
}.start(wait = true) | ||
``` |
Oops, something went wrong.