Skip to content

Instantly share code, notes, and snippets.

@recalde
Created November 14, 2024 03:19
Show Gist options
  • Save recalde/720b154f6b0bb79d1657d7d746b0c37b to your computer and use it in GitHub Desktop.
Save recalde/720b154f6b0bb79d1657d7d746b0c37b to your computer and use it in GitHub Desktop.
OpenShift OAuth
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
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