Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot perform post-auth claims transformation #15

Open
jptillman opened this issue Apr 12, 2019 · 0 comments
Open

Cannot perform post-auth claims transformation #15

jptillman opened this issue Apr 12, 2019 · 0 comments

Comments

@jptillman
Copy link

jptillman commented Apr 12, 2019

In my system, I need to add additional claims after a successful keycloak authentication AND have the authenticated user persisted in the cookie so the auth doesn't happen on each page load. There appears to be no hook in this library for a ClaimsTransformation to be performed.
Following the instructions at https://github.com/dylanplecki/KeycloakOwinAuthentication/wiki/ASP.NET-MVC-Tutorial (which is the only example code I can find anywhere using any KeyCloak library similar to this fork), my code looks like this:

            const string persistentAuthType = "cookie_auth";

            app.SetDefaultSignInAsAuthenticationType(persistentAuthType); // Cookie is primary session store
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = persistentAuthType,         
            });          

            // --- Keycloak Authentication Middleware - Connects to central Keycloak database
            app.UseKeycloakAuthentication(new KeycloakAuthenticationOptions
            {
                ClientId = clientName,
                ClientSecret = clientSecret,
                Realm = clientRealm,
                KeycloakUrl = authorityUrlBase,
                SignInAsAuthenticationType = persistentAuthType,
                AuthenticationType = ssoAuthType,
                DisableAudienceValidation = true,
                Scope = "openid profile email",
                EnableBearerTokenAuth = true,
                // per https://github.com/mattmorg55/Owin.Security.Keycloak/pull/13
                DisableAllRefreshTokenValidation = true,
            });   

Where do I transform?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant