claims-based-identity

Seeking Confirmation that IdentityServer 3 does not support Custom Claims without 2nd call to server

回眸只為那壹抹淺笑 提交于 2019-12-21 01:57:24
问题 It appears to me that I cannot add a custom claim (that is user-specific) to the response of my first call to Identity Server. Can someone confirm that assumption? Here is what we are doing in our app: Using ResourceOwner Flow, our web app (server side) calls Identity Server sending the user's logonID and password and scopes. We get back a JWT which contains the standard claims like sub, idp, client_id; but we would like to add one more. To simplify, let's say that one additional claim is the

Claims Auth with OWIN Self Hosted WebApi

天大地大妈咪最大 提交于 2019-12-20 18:09:07
问题 I am self hosting WebApi with the following configuration: Visual Studio 2012 / .NET 4.0 public void Configuration(IAppBuilder appBuilder) { var config = new HttpConfiguration(); // authentication config.MessageHandlers.Add(new Shield.PresharedKeyAuthorizer()); // routing config.Routes.MapHttpRoute( name: "Default", routeTemplate: "{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); appBuilder.UseWebApi(config); } I have a simple test setup with the following

Users Roles Permissions using ASP.NET Core Identity 3

允我心安 提交于 2019-12-20 10:47:25
问题 I'm stuck on a solution that I would like to provide in an asp.net mvc core application. I would like to provide a solution to the standard User, Roles, Permissions in a web application leveraging the new Claims based approach. I've been following Ben Foster's logic here (http://benfoster.io/blog/asp-net-identity-role-claims). In the code below (demo quality) I illustrate my methodology which I will comment to help show my quick and dirty test solution. The challenge I have is, that its not

Custom Identity using MVC5 and OWIN

只愿长相守 提交于 2019-12-20 08:40:21
问题 I trying to add custom properties to the ApplicationUser for a web site using MVC5 and OWIN authentication. I've read https://stackoverflow.com/a/10524305/264607 and I like how it integrates with the base controller for easy access to the new properties. My issue is that when I set the HTTPContext.Current.User property to my new IPrincipal I get a null reference error: [NullReferenceException: Object reference not set to an instance of an object.] System.Web.Security.UrlAuthorizationModule

ASP .NET CORE 2.2 JWT & Claims identity Authentication for Website

≯℡__Kan透↙ 提交于 2019-12-20 06:36:09
问题 I have an .net core 2.2 api which generates (on a successful login) a JWT token which contains a claims identity that passes along information such as the username, permissions and roles of the authenticated user. In my .net core 2.2. web app I have a login mechanism which retrieves the JWT token via the user of a controller. My question is. How can I expand the token from within my login controller and set up my web app to include the use of the authentication mechanisms like User.Identity

NameIdentifier vs ObjectIdentifier

ぐ巨炮叔叔 提交于 2019-12-19 05:08:25
问题 I have a multitenant ASP.NET application using OpenIdConnect and Azure AD as an Identity provider for Office 365. When the user is authenticated I receive my claims in ClaimsPrincipal.Current . I wanted to identify a user and store this id reference in my database. I asked this question. It was replied that When trying to identify a user uniquely [NameIdentifier] should be your go-to choice. But it seems that the NameIdentifier claim, http://schemas.xmlsoap.org/ws/2005/05/identity/claims

A custom login page for Azure ACS not working

不打扰是莪最后的温柔 提交于 2019-12-19 04:14:05
问题 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

How to set TimeOut for OwinContext in MVC 5

China☆狼群 提交于 2019-12-18 18:53:25
问题 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()));

Caching Claims in .net core 2.0

喜欢而已 提交于 2019-12-18 17:30:22
问题 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,

Asp.Net Identity - Setting CookieDomain at runtime

只谈情不闲聊 提交于 2019-12-18 16:31: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 回答1: You can assign your own cookie provider: CookieAuthProvider myProvider = new CookieAuthProvider(); app.UseCookieAuthentication(new