Created
November 14, 2024 03:19
-
-
Save recalde/720b154f6b0bb79d1657d7d746b0c37b to your computer and use it in GitHub Desktop.
OpenShift OAuth
This file contains hidden or 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
apiVersion: oauth.openshift.io/v1 | |
kind: OAuthClient | |
metadata: | |
name: my-aspnet-app | |
secret: <your-client-secret> | |
redirectURIs: | |
- https://my-aspnet-app.example.com/signin-oidc | |
grantMethod: auto |
This file contains hidden or 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
services.AddAuthentication(options => | |
{ | |
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; | |
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; | |
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; | |
}) | |
.AddCookie() | |
.AddOpenIdConnect(options => | |
{ | |
options.Authority = "https://<openshift-auth-server>"; | |
options.ClientId = "my-aspnet-app"; | |
options.ClientSecret = "<your-client-secret>"; | |
options.CallbackPath = "/signin-oidc"; | |
options.ResponseType = "code"; | |
options.SaveTokens = true; | |
options.GetClaimsFromUserInfoEndpoint = true; | |
options.Scope.Add("openid"); | |
options.Scope.Add("profile"); | |
options.Scope.Add("email"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment