dylanplecki / keycloakowinauthentication Goto Github PK
View Code? Open in Web Editor NEWKeycloak Authentication Middleware for the C# OWIN Pipeline
Home Page: http://keycloak.jboss.org
License: MIT License
Keycloak Authentication Middleware for the C# OWIN Pipeline
Home Page: http://keycloak.jboss.org
License: MIT License
Please add in wiki which versions of the keycloak the library is compatible
I have few questions:
If this library doesnot support refresh token, then what is the way to proceed.
Thanks
I have a Keycloak client configured like this
- Standard (code) flow
- Client secret (access type: confidential)
In an ASP.NET MVC app, when the Keycloak library is authorizing the user by doing a redirect to the Keycloak authorization endpoint (=requesting an access code), it includes the client secret in the URL visible is the user's browser.
Is that correct? Shouldn't the client secret only be used in the "back channel" when the library request an Id/Access Token based on the access code (via HTTP post)?
Hello,
What are the benefits of using a special middleware to connect to keycloak IdP instead of relying on the Microsoft's OpenIdConnectAuthentication middleware which is supposed to work with any OIDC IdP?
Thanks
Peter
I try to use a demo app with very small ticket life (Access token 5 minutes and refresh token 15 minutes).
From the first run i receive error "Both the access token and the refresh token have expired".
I am in UTC+2 time zone and now (summer time) i am at UTC+3. I think this is the problem.
I looked into the code on file KeycloakTokenHandler.cs and line 125, and i can see notBefore parsed from jwt parser but i think jwt parser didn't cast time to local time and later in KeycloakIdentity.cs on GetClaimsAsync you check datetimes as locals. So when i changed the KeycloakTokenHandler.cs and line 125 from: notBefore = jwt.ValidFrom;
to: notBefore = ((long) jwt.Payload.Nbf.Value).ToDateTime();
(using must be include to see the extension function)
everything working fine.
Please check if this is feature or bug.
The following error is returned when the machine uses local time zone:
Server Error in '/' Application.
Both the access token and the refresh token have expired
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Both the access token and the refresh token have expired
Source Error:
Line 441: // Validate refresh token expiration
Line 442: if (_refreshToken.ValidTo <= DateTime.Now)
Line 443: throw new Exception("Both the access token and the refresh token have expired");
Line 444:
Line 445: // Load new identity from token endpoint via refresh token
Source File: C:\Users\mcs\Documents\Visual Studio 2015\Projects\keycloak\KeycloakOwinAuthentication\src\KeycloakIdentityModel\KeycloakIdentity.cs Line: 443
Hint: DateTime.Now returns local time. Please consider using DateTime.UtcNow where needed.
Hi, Is there any example about how to config a bearer only wcf rest api, please help me.
if i use
app.UseKeycloakAuthentication(new KeycloakAuthenticationOptions { ...... UseRemoteTokenValidation = true });
The the server send error
Invalid state: Please reattempt the request
When I try to run the app in IIS outside VS I am getting this error:
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Requested URL http://192.168.1.223:80/myApp/owin/security/keycloak/KeycloakAuthentication/callback
Physical Path D:\Projects\Keycloak\KeycloakOwinAuthentication-master\src\SampleKeycloakApp\owin\security\keycloak\KeycloakAuthentication\callback
Where myApp is the virtual folder in IIS. The sample works fine running from Visual Studio.
Any idea what I am doing wrong?
Thanks
Please add description and wiki for ASP.NET 4.5 Web API
When running the sample code and attempting to authenticate, it ends up in a redirect loop.
http://localhost:60416/Home/About
http://devkeycloak.dev.local:8080/auth/realms/Test%20Realm/protocol/openid-connect/auth?redirect_uri=http%3A%2F%2Flocalhost%3A60416%2Fowin%2Fsecurity%2Fkeycloak%2FKeycloakAuthentication%2Fcallback&response_type=code&scope=openid&state=oidc_state_85cbe0739a4c43fb81b2dfe9f7f7168a&client_id=test-app&client_secret=e4f66f12-29d6-49e3-be0c-65ab9b312f07
http://localhost:60416/owin/security/keycloak/KeycloakAuthentication/callback?code=e5N-NJYJJOkU7szSBFIa30oC8x0D9b4Ye1sOGH5m0Dg.f12991ff-8391-4583-9683-993f7eb5ff47&state=oidc_state_85cbe0739a4c43fb81b2dfe9f7f7168a
http://devkeycloak.dev.local:8080/auth/realms/Test%20Realm/protocol/openid-connect/token
When it redirects back to http://localhost:60416/Home/About
it starts over again.
Are there any Keycloak settings I'm missing?
I cloned the sample project twice and called them App1 and App2 to implement SSO using Keycloak.
I configured a single Realm in Keycloak with 2 apps, and a Test user with all roles. but whenever I log in from an app, I get a server error from the other! The two apps are in my repository..
Error text:
".... IDX10214: Audience validation failed. Audiences: 'App1'. Did not match: validationParameters.ValidAudience: 'null' or validationParameters.ValidAudiences: 'null, App2'"
I was trying out the library and had some initial configuration problems. I found that errors were swallowed in this piece of code in KeycloakAuthenticationHandler.cs
. I wonder if there could be a possibility to log these errors (and a short paragraph in the configuration guide where to find the log information). This would have saved me some time, and I would need that before going to any non-testing environment.
catch (Exception)
{
// ignored
}
I am totally new .net core (even to git) and bit familiar with key cloak with respect to .net f/w MVC application. I couldn't find working sample code to implement ASP.NET Core key claok auth, Is there any sample application/code snippet or any guide how to implement key cloak auth in ASP.NET Core 3.1
Can you please provide example for keycloak owin authentication (sso) in asp.net 5? Urgent!!!
Server Error in '/' Application.
Value cannot be null.
Parameter name: uriString
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
When trying to log out via Request.GetOwinContext().Authentication.SignOut(), I get the following error:
Value cannot be null.
Parameter name: uriString
[ArgumentNullException: Value cannot be null.
Parameter name: uriString]
System.Uri..ctor(String uriString) +6766781
Owin.Security.Keycloak.Middleware.d__10.MoveNext() +120
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +26
Owin.Security.Keycloak.Middleware.d__2.MoveNext() +243
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
...
A quick workaround is to delete the aspnet cookie and hit the OIDC logout url:
if (Request.Cookies[".AspNet.kcook"] != null) { HttpCookie myCookie = new HttpCookie(".AspNet.kcook"); myCookie.Expires = DateTime.Now.AddDays(-1d); Response.Cookies.Add(myCookie); } Response.Redirect("https://idmendpoint.com/auth/realms/MyRealm/protocol/openid-connect/logout?redirect_uri=https%3A%2F%2Flocalhost%3A44303");
Does this work in .net core?
Does this have a check to get the refresh token?
Hi
We have a asp.net 5 project requiering Keycloack login so your project is a perfect fit. Is there support for asp.net 5?
Best regards Aslak
Issue when running the application.
please find the debug error list.
Please help me to solve the issue.
Error 51 'KeycloakIdentityModel.KeycloakIdentity._accessToken' is a 'field' but is used like a 'type' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 70 KeycloakIdentityModel
Error 50 'KeycloakIdentityModel.KeycloakIdentity._kcClaims' is a 'field' but is used like a 'type' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 49 KeycloakIdentityModel
Error 49 'KeycloakIdentityModel.KeycloakIdentity._parameters' is a 'field' but is used like a 'type' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 49 54 KeycloakIdentityModel
Error 86 'KeycloakIdentityModel.Utilities.ClaimMapping.ClaimMappings' does not contain a definition for 'IdTokenMappings' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 402 94 KeycloakIdentityModel
Error 87 'KeycloakIdentityModel.Utilities.ClaimMapping.ClaimMappings' does not contain a definition for 'RefreshTokenMappings' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 413 90 KeycloakIdentityModel
Error 52 'System.DateTime.Now' is a 'property' but is used like a 'type' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 102 KeycloakIdentityModel
Error 1 ; expected C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 49 51 KeycloakIdentityModel
Error 3 ; expected C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 46 KeycloakIdentityModel
Error 16 A namespace cannot directly contain members such as fields or methods C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 17 14 KeycloakIdentityModel
Error 69 Cannot await in the body of a catch clause C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 250 17 KeycloakIdentityModel
Error 17 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 18 17 KeycloakIdentityModel
Error 18 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 23 17 KeycloakIdentityModel
Error 19 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 30 17 KeycloakIdentityModel
Error 20 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 37 17 KeycloakIdentityModel
Error 21 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 42 17 KeycloakIdentityModel
Error 22 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 47 17 KeycloakIdentityModel
Error 23 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 52 17 KeycloakIdentityModel
Error 24 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 57 17 KeycloakIdentityModel
Error 25 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 62 17 KeycloakIdentityModel
Error 26 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 69 23 KeycloakIdentityModel
Error 27 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 69 79 KeycloakIdentityModel
Error 28 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 71 23 KeycloakIdentityModel
Error 29 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 71 84 KeycloakIdentityModel
Error 30 Expected class, delegate, enum, interface, or struct C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 73 17 KeycloakIdentityModel
Error 4 Invalid token '!=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 59 KeycloakIdentityModel
Error 12 Invalid token '(' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimLookup.cs 14 84 KeycloakIdentityModel
Error 37 Invalid token '(' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 108 76 KeycloakIdentityModel
Error 40 Invalid token '(' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 129 85 KeycloakIdentityModel
Error 14 Invalid token ',' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 15 58 KeycloakIdentityModel
Error 2 Invalid token ';' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 49 84 KeycloakIdentityModel
Error 6 Invalid token ';' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 105 KeycloakIdentityModel
Error 8 Invalid token '{' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 12 9 KeycloakIdentityModel
Error 9 Invalid token '{' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 14 13 KeycloakIdentityModel
Error 7 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 11 77 KeycloakIdentityModel
Error 10 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimLookup.cs 14 59 KeycloakIdentityModel
Error 13 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 15 27 KeycloakIdentityModel
Error 15 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 16 30 KeycloakIdentityModel
Error 31 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 75 67 KeycloakIdentityModel
Error 33 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 84 55 KeycloakIdentityModel
Error 34 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 92 59 KeycloakIdentityModel
Error 35 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 100 61 KeycloakIdentityModel
Error 36 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 108 54 KeycloakIdentityModel
Error 38 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 120 60 KeycloakIdentityModel
Error 39 Invalid token '=' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Models\Configuration\DefaultKeycloakParameters.cs 129 63 KeycloakIdentityModel
Error 11 Invalid token '=>' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimLookup.cs 14 67 KeycloakIdentityModel
Error 5 Invalid token '>' in class, struct, or interface member declaration C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 54 91 KeycloakIdentityModel
Error 41 Metadata file 'C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\bin\Debug\KeycloakIdentityModel.dll' could not be found C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\Owin.Security.Keycloak\CSC Owin.Security.Keycloak
Error 42 Metadata file 'C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\Owin.Security.Keycloak\bin\Debug\Owin.Security.Keycloak.dll' could not be found C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\SampleKeycloakApp\CSC SampleKeycloakApp
Error 43 Property or indexer 'KeycloakIdentityModel.Utilities.OidcDataManager.Authority' cannot be assigned to -- it is read only C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\OidcDataManager.cs 33 13 KeycloakIdentityModel
Error 44 Property or indexer 'KeycloakIdentityModel.Utilities.OidcDataManager.MetadataEndpoint' cannot be assigned to -- it is read only C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\OidcDataManager.cs 34 13 KeycloakIdentityModel
Error 45 Property or indexer 'KeycloakIdentityModel.Utilities.OidcDataManager.TokenValidationEndpoint' cannot be assigned to -- it is read only C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\OidcDataManager.cs 35 13 KeycloakIdentityModel
Error 57 The call is ambiguous between the following methods or properties: 'System.Threading.Tasks.Task.Run<System.Security.Claims.ClaimsIdentity>(System.Func<System.Threading.Tasks.Task<System.Security.Claims.ClaimsIdentity>>)' and 'System.Threading.Tasks.Task.Run(System.Action)' C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 127 20 KeycloakIdentityModel
Error 48 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 39 69 KeycloakIdentityModel
Error 53 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 82 64 KeycloakIdentityModel
Error 54 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 93 65 KeycloakIdentityModel
Error 55 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 104 64 KeycloakIdentityModel
Error 56 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 117 64 KeycloakIdentityModel
Error 58 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 170 69 KeycloakIdentityModel
Error 59 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 171 67 KeycloakIdentityModel
Error 60 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 184 69 KeycloakIdentityModel
Error 61 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 185 65 KeycloakIdentityModel
Error 62 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 204 69 KeycloakIdentityModel
Error 63 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 205 66 KeycloakIdentityModel
Error 64 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 219 69 KeycloakIdentityModel
Error 65 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 220 67 KeycloakIdentityModel
Error 66 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 221 66 KeycloakIdentityModel
Error 67 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 239 69 KeycloakIdentityModel
Error 68 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 240 70 KeycloakIdentityModel
Error 70 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 265 69 KeycloakIdentityModel
Error 71 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 266 66 KeycloakIdentityModel
Error 72 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 286 69 KeycloakIdentityModel
Error 73 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 287 66 KeycloakIdentityModel
Error 74 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 302 69 KeycloakIdentityModel
Error 75 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 303 66 KeycloakIdentityModel
Error 76 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 304 70 KeycloakIdentityModel
Error 77 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 341 69 KeycloakIdentityModel
Error 78 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 345 49 KeycloakIdentityModel
Error 79 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 347 49 KeycloakIdentityModel
Error 80 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 351 49 KeycloakIdentityModel
Error 81 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 353 49 KeycloakIdentityModel
Error 82 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 355 49 KeycloakIdentityModel
Error 83 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 359 45 KeycloakIdentityModel
Error 84 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 362 45 KeycloakIdentityModel
Error 85 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 365 45 KeycloakIdentityModel
Error 88 The name 'nameof' does not exist in the current context C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\KeycloakIdentity.cs 460 66 KeycloakIdentityModel
Error 32 Type or namespace definition, or end-of-file expected C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\ClaimMapping\ClaimMappings.cs 80 9 KeycloakIdentityModel
Warning 46 The variable 'exception' is declared but never used C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\OidcDataManager.cs 146 40 KeycloakIdentityModel
Warning 47 The variable 'exception' is declared but never used C:\Users\vramanathan\Downloads\KeycloakOwinAuthentication-master (1)\KeycloakOwinAuthentication-master\src\KeycloakIdentityModel\Utilities\OidcDataManager.cs 187 30 KeycloakIdentityModel
Anyone try getting it to work with Secure JWT and not ClientID and Secret?
Add the following options and implement:
EnableBearerTokenAuth
ForceBearerTokenAuth
(auto enables EnableBearerTokenAuth
)Today, 1st February (1/2/2016)I realized that all my tokens were expired due to a problem with date format - it was converting wrongly all dates to 2nd January.
DateTime.TryParse() in KeycloakAuthenticationHandler file is not using InvariantCulture
To fix this the DateTime.TryParse() in SignInAsAuthentication(...) must be changed to something like
DateTime.TryParse(expStr, CultureInfo.InvariantCulture, DateTimeStyles.None, out expDate)
Firstly, apologies if this is the wrong forum such a question.
I am wondering if Owin is suitable / capable of achieving the following use-case.
I have a c# dll that is basically a plugin in another system. This dll has no UI. It is basically taking messages from the host application, sending them to a server for processing and then receiving the response. The user/owner of the host application needs to be authenticated to use this dll. I was thinking that the user would have a KeyCloak service account, and therefore have a token in a properties file.
Is such a use case possible using KeycloakIdentityModel ?
Hi,
Thank you for creating this library. I just cloned the sample ASP.Net 5 project and tried to ran the app with my own keycloak server settings. For the first time I received an exception related to the "audience" validation, since I dont need that I just disabled that using the property "DisableAudienceValidation". Now I am getting another exception related to SecurityKeyIdentifier.
Could you please let me know what is missing?
The exception is as below.
IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier
(
IsReadOnly = False,
Count = 1,
Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
)
',
token: '{"alg":"HS256","typ":"JWT","kid":"4718be89-a61c-4007-b355-6c85319c9c9f"}.{"jti":"8635361e-7825-40d9-94a4-faae4b3fe264","exp":1565278106,"nbf":0,"iat":1565276306,"iss":"http://localhost:8080/auth/realms/master","aud":"http://localhost:8080/auth/realms/master","sub":"dd09c01c-be26-48b6-9942-efc0b1abc3b6","typ":"Refresh","azp":"sampleclient","auth_time":0,"session_state":"a59830f0-9fd2-4bf4-ae74-7dda461aab0f","realm_access":{"roles":["offline_access","uma_authorization"]},"resource_access":{"account":{"roles":["manage-account","manage-account-links","view-profile"]}},"scope":"openid email profile"}'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.