claims-based-identity

A custom login page for Azure ACS not working

你离开我真会死。 提交于 2019-12-01 01:10:34
I downloaded the sample login page from the ACS portal for my application, which is a html file. I then configured my application with WIF, and everything worked perfectly. Since we need to handle and save an incoming querystring, so that querystring can be used later after the user had been logged in, we needed to move the html login page to a aspx page. The problem is that when I change the issuer for WIF in the web.config file to the aspx file, it stops working. When it works it looks like this: <certificateValidation certificateValidationMode="None" /> <federatedAuthentication>

IdentityServer4: Add Custom default Claim to Client Principal for Client_Credential Granttype

女生的网名这么多〃 提交于 2019-12-01 00:51:26
问题 I am using IdentityServer4 and I am trying to add a custom default claim to my CLIENT when the token is created. This is possible if i use the implicit flow and IProfileService like shown below. public class MyProfileService : IProfileService { public MyProfileService() { } public Task GetProfileDataAsync(ProfileDataRequestContext context) { var claims = new List<Claim> { new Claim("DemoClaimType", "DemoClaimValue") }; context.IssuedClaims = claims; return Task.FromResult(0); } public Task

Add a claim to JWT as an array?

大兔子大兔子 提交于 2019-11-30 18:26:30
Using thinktecture JWT authentication resource owner flow,i use the claims part of JWT for client consumption. My question is that if its possible to add claim in identity server and decode it as an array in client. There is no ClaimTypeValues for array type. As a workaround, var user = IdentityServerPrincipal.Create(response.UserName, response.UserName); user.Identities.First().AddClaims( new List<Claim>() { new Claim(ClaimTypes.Name, response.UserName), new Claim(ClaimTypes.Email, response.Email), new Claim(FullName, response.FullName), new Claim(AuthorizedCompanies,JsonConvert

How to set TimeOut for OwinContext in MVC 5

人走茶凉 提交于 2019-11-30 17:37:07
When a user access a website and enters their credentials which are stored in our database, we when create an authentication. How do you set the timeout? Using MVC 5. My Authentication looks like this: var claims = new List<Claim>(); claims.Add(new Claim("UserId", user.UserID.ToString())); claims.Add(new Claim(ClaimTypes.Name, user.FirstName + " " + user.LastName)); claims.Add(new Claim(ClaimTypes.Email, user.Email)); claims.Add(new Claim(ClaimTypes.NameIdentifier, user.UserID.ToString())); var id = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie); var ctx = Request

Add a claim to JWT as an array?

瘦欲@ 提交于 2019-11-30 16:48:50
问题 Using thinktecture JWT authentication resource owner flow,i use the claims part of JWT for client consumption. My question is that if its possible to add claim in identity server and decode it as an array in client. There is no ClaimTypeValues for array type. As a workaround, var user = IdentityServerPrincipal.Create(response.UserName, response.UserName); user.Identities.First().AddClaims( new List<Claim>() { new Claim(ClaimTypes.Name, response.UserName), new Claim(ClaimTypes.Email, response

Caching Claims in .net core 2.0

狂风中的少年 提交于 2019-11-30 15:21:17
Looked up everywhere but looks like I am stuck right now. I am using Windows Active Directory in my application for authentication. For authorization, I am using claims. After searching through the limited .net core documentation, this is how my code looks like. Startup.cs public void ConfigureServices(IServiceCollection services) { services.AddTransient<IPrincipal>( provider => provider.GetService<IHttpContextAccessor>().HttpContext.User); services.AddTransient<IClaimsTransformation, ClaimsTransformer>(); services.AddAuthentication(IISDefaults.AuthenticationScheme); } ClaimsTransformer.cs

Asp.Net Identity - Setting CookieDomain at runtime

☆樱花仙子☆ 提交于 2019-11-30 14:01:35
How can I set the CookieDOmain in the CookieAuthenticationOptions at runtime if i want to pull this value from the Request.Url or from some settings stored in my database? I want to support sub-domains, but also support multi-tenants too which each have different domains. At the moment this is configured I don't have access to either of these. Paul You can assign your own cookie provider: CookieAuthProvider myProvider = new CookieAuthProvider(); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new

ADFS 2.0 time out and relation between Freshness Value,TokenLifetime and WebSSOLifetime parameters

依然范特西╮ 提交于 2019-11-30 09:02:31
问题 I am interested to know the relation between Freshness Value,TokenLifetime and WebSSOLifetime parameters in ADFS 2.0 time out scenario. I have already did my bit of analysis on this and I am yet to get a clear picture. 回答1: I have collected the below details w.r.t ADFS timeout through several sources. There are two major timeouts involved in the ADFS configuration: WebSSOLifetime – Server wide timeout parameter – Default value = 480 mins TokenLifetime – This is configured for each Relying

Transforming Open Id Connect claims in ASP.Net Core

佐手、 提交于 2019-11-30 06:57:46
I'm writing an ASP.Net Core Web Application and using UseOpenIdConnectAuthentication to connect it to IdentityServer3. Emulating their ASP.Net MVC 5 sample I'm trying to transform the claims received back from Identity Server to remove the " low level protocol claims that are certainly not needed ." In MVC 5 they add a handler for the SecurityTokenValidated Notification that swaps out the AuthenticationTicket for one with just the required claims. In ASP.Net Core, to do the equivalent, I thought that I would need to handle the OnTokenValidated in the OpenIdConnectEvents . However, at that

ASP.NET Identity “Role-based” Claims

江枫思渺然 提交于 2019-11-30 06:27:16
I understand that I can use claims to make statements about a user: var claims = new List<Claim>(); claims.Add(new Claim(ClaimTypes.Name, "Peter")); claims.Add(new Claim(ClaimTypes.Email, "peter@domain.com")); But how should I store "role-based" claims? For example: The user is a super administrator. claims.Add(new Claim("IsSuperAdmin, "true")); The value parameter "true" feels completely redundant. How else can this statement be expressed using claims? This is already done for you by the framework. When user is logged in, all user roles are added as claims with claims type being ClaimTypes