Merge pull request #8 from SunriseM/feature/multiple-redirects

Allow multiple redirect urls
This commit is contained in:
Enes Sadık Özbek 2020-12-28 17:24:55 +03:00 committed by GitHub
commit 0e7206c3b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View file

@ -1,10 +1,13 @@
# Steam OpenId Connect Provider # Steam OpenId Connect Provider
Steam OpenID 2.0 -> OpenID Connect Provider Proxy Steam OpenID 2.0 -> OpenID Connect Provider Proxy
## About ## About
This server allows you to use Steam as an OpenID Connect Identity provider (OIDC IDP). This way you can use Steam logins in KeyCloak or any other OpenID Connect based authentication client.
This server allows you to use Steam as an OpenID Connect Identity provider (OIDC IDP). This way you can use Steam logins in KeyCloak or any other OpenID Connect based authentication client.
## Setup ## Setup
Add your Steam API Key as user-secrets like this: Add your Steam API Key as user-secrets like this:
`dotnet user-secrets set "Authentication:Steam:ApplicationKey" "MySteamApiKey"` `dotnet user-secrets set "Authentication:Steam:ApplicationKey" "MySteamApiKey"`
@ -14,19 +17,26 @@ Alternatively you can set it up via environment variables:
After that set up your redirect URI, ClientID and ClientSecret in the appsettings.json. After that set up your redirect URI, ClientID and ClientSecret in the appsettings.json.
If you need to set up multiple redirect URIs, you can set them separated by a comma.
`OpenID__RedirectUri="http://localhost:8080/auth/realms/master/broker/steam/endpoint, http://localhost:8080/auth/realms/dev/broker/steam/endpoint"`
## OpenID Configuration ## OpenID Configuration
You can access Authorization and Token endpoint details in You can access Authorization and Token endpoint details in
`http://<Your Host>/.well-known/openid-configuration` `http://<Your Host>/.well-known/openid-configuration`
## Supported Scopes ## Supported Scopes
The following scopes are supported: `openid`, `profile`. The following scopes are supported: `openid`, `profile`.
If you use the `profile` scope, you get access to the `picture`, `given_name`, `website` and `nickname` claims too. If you use the `profile` scope, you get access to the `picture`, `given_name`, `website` and `nickname` claims too.
## HTTPS Support ## HTTPS Support
This server does not support https connections. If you want to use https connections please use a reverse proxy like nginx. This server does not support https connections. If you want to use https connections please use a reverse proxy like nginx.
## Running behind reverse proxies ## Running behind reverse proxies
Some reverse proxy setups might require additional configuration, like setting the path base or origin. Some reverse proxy setups might require additional configuration, like setting the path base or origin.
To set the origin, set `Hosting:PublicOrigin` in the appsettings.json or the `Hosting__PublicOrigin` environment variable to your desired origin. If not set, the origin name is inferred from the request. To set the origin, set `Hosting:PublicOrigin` in the appsettings.json or the `Hosting__PublicOrigin` environment variable to your desired origin. If not set, the origin name is inferred from the request.
@ -34,20 +44,24 @@ To set the origin, set `Hosting:PublicOrigin` in the appsettings.json or the `Ho
Similary, you can use the `Hosting:PathBase` in the appsettings.json or the `Hosting__PathBase` environment variable to set the path base. If not set, it will default to "/". Similary, you can use the `Hosting:PathBase` in the appsettings.json or the `Hosting__PathBase` environment variable to set the path base. If not set, it will default to "/".
## Health checks ## Health checks
This service contains a health check endpoint at `/health`. It checks if the Steam login servers are working. This service contains a health check endpoint at `/health`. It checks if the Steam login servers are working.
## Docker ## Docker
[A docker image](https://hub.docker.com/r/imperialplugins/steam-openid-connect-provider) is also available. [A docker image](https://hub.docker.com/r/imperialplugins/steam-openid-connect-provider) is also available.
``` ```
docker run -it \ docker run -it \
-e OpenID__RedirectUri=http://localhost:8080/auth/realms/master/broker/steam/endpoint \ -e OpenID__RedirectUri=http://localhost:8080/auth/realms/master/broker/steam/endpoint \
-e OpenID__ClientID=steamidp \ -e OpenID__ClientID=steamidp \
-e OpenID__ClientSecret=mysecret \ -e OpenID__ClientSecret=mysecret \
-e Authentication__Steam__ApplicationKey=MySteamApiKey \ -e Authentication__Steam__ApplicationKey=MySteamApiKey \
--restart unless-stopped \ --restart unless-stopped \
--name steamidp \ --name steamidp \
imperialplugins/steam-openid-connect-provider imperialplugins/steam-openid-connect-provider
``` ```
## License ## License
[MIT](https://github.com/ImperialPlugins/steam-openid-connect-provider/blob/master/LICENSE) [MIT](https://github.com/ImperialPlugins/steam-openid-connect-provider/blob/master/LICENSE)

View file

@ -1,4 +1,6 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq;
using IdentityServer4; using IdentityServer4;
using IdentityServer4.Models; using IdentityServer4.Models;
@ -20,7 +22,7 @@ namespace SteamOpenIdConnectProvider
}, },
// where to redirect to after login // where to redirect to after login
RedirectUris = { redirectUri }, RedirectUris = redirectUri.Split(",").Select(x => x.Trim()).ToArray(),
// where to redirect to after logout // where to redirect to after logout
PostLogoutRedirectUris = { logoutRedirectUri }, PostLogoutRedirectUris = { logoutRedirectUri },