claims-based-identity

ClaimsAuthorizationManager pull policies from database

ε祈祈猫儿з 提交于 2019-12-06 07:55:11
问题 I'm new to the Claims Security approach for authorizing users access to resources. I've been doing a lot of research and the majority of sites I've read have the policies for ClaimsAuthorizationManager entered in Web.config file. What are some ways to accomplish this? Can you point me to some links where policies are served from a database? Thanks. 回答1: I also ran into the same problem. Hopefully these links will help you. What I did was implemented my own ClaimsAuthorizationManager to get

What is the best way to retrieve a WindowsIdentity from a ClaimsIdentity

喜欢而已 提交于 2019-12-06 05:51:04
问题 So far I found out two solutions to get a WindowsIdentity object from a ClaimsIdentity. First I extract the user principal name (upn). ClaimsIdentity ci = (ClaimsIdentity) Thread.CurrentPrincipal.Identity; string upn = null; foreach (Claim c in ci.Claims) { if (c.ClaimType == ClaimTypes.Upn) { upn = c.Value; break; } } Just call the constructor of WindowsIdentity with the upn: WindowsIdentity winId = new WindowsIdentity(upn); Use Claims to Windows Token Service (c2WTS): WindowsIdentity winId

MVC5 Web app using ADFS On-Premises Organizational Auth and Visual Studio 2013 localhost development

我与影子孤独终老i 提交于 2019-12-06 05:42:27
I am trying to create an MVC5 Web Application configured to use the On-Premises Organizational Authenticated Option (ADFS) as described Here by Vittorio Bertocci First, I create new MVC project. Then I change the Authentication to On-Premises. Set the On-Premises Authority to my ADFS federation metadata Endpoint. I checked to make sure the federation metadata xml could be reached and it was. I leave the App ID URI field blank accepting the default value. I ve done both, provided a value and left blank. I then configured my relying party app manually. Setting the relying party WS-Federation

Using Custom RoleProvider with Windows Identity Foundation - STS

穿精又带淫゛_ 提交于 2019-12-06 04:07:08
I created STS that does the authentication part. It uses Custom Membership provider. After successful login I get redirected to my RP website. All works fine in terms of authentication. I have defined a CustomRolesProvider defined in web.config of my RP website. It uses the username returned by STS to fetch the roles for that user from RP's database. When I use Roles.GetRolesForUser I do get the right roles. I have the following in the web.config of my RP to allow only admin to give access to admin folder. And the sitemap provider has securityTrimmingEnabled="true" <location path="admin">

Using Claims with OpenIdConnect.Server in ASP.NET 5

百般思念 提交于 2019-12-06 02:29:40
问题 In the past 7 days I've tried to setup an ASP.NET 5 WebApi using OpenIdConnect.Server with the resource owner flow. I was more or less successful in generating a token and accessing [Authorize] protected actions. However, when I try to access this.User.Identity.Claims , it's empty. I am using ASP.NET 5, beta6 for now (having troubles upgrading to most recent beta7 and waiting for it's official release) In the Startup.cs I got the following: public void ConfigureServices(IServiceCollection

Different Service behaviors per endpoint

有些话、适合烂在心里 提交于 2019-12-06 00:11:05
问题 The situation We are implementing different sort of security on some WCF service. ClientCertificate, UserName & Password and Anonymous. We have 2 ServiceBehaviorConfigurations, one for httpBinding and one for wsHttpBinding. ( We have custom authorization policies for claim based security ) As a requirement we need different endpoints for each service. 3 endpoints with httpBinding and 1 with wsHttpBinding. Example for one service: basicHttpBinding : Anonymous basicHttpBinding :

Looking for a secure and robust STS implementation

拈花ヽ惹草 提交于 2019-12-05 20:29:41
I am faced with a project that uses custom authentication via a WCF service that returns a set of claims based on some data identifying a user, close to user name and password. Then on top of this, I have a custom STS, derived from Microsoft.IdentityModel.SecurityTokenService , that resides in an ASP.NET web site project. This project looks like it was created with the VS2010 template, and not carefully had-crafted. My gut feeling, and lots of on-line advice tell me that this web site STS project is very far from production ready. I am now looking for an MVC based STS that I can use in

Custom WebApi Authorization Database Call

丶灬走出姿态 提交于 2019-12-05 19:33:48
I'm trying to decide if the custom Authorization attribute I wrote is really a good idea. Scenario Say we have a collection of stores, each Store has an owner. Only the owner of the store can do CRUD operations on the store. EXCEPT for users with a Claim that basically overrides the ownership requirement and says they can do CRUD operations on ANY store. Sidenote: I'm using Thinktecture and ADFS So I made a StoreOwnerAuthorize attribute who's parameters ("Manage", "Stores") are used to check if the user has the appropriate claim to "override" not being an owner but still able to pass the

Asp.Net Identity - case insensitive email and usernames

落花浮王杯 提交于 2019-12-05 19:27:30
Is there a way to get Asp.Net Identity to be case insensitive with email addresses and usernames? At the moment if I call "FindByEmailAsync(email)" it will only work if the email address is being stored exactly as it's is typed (case sensitive) You can change how the user is registered so that the username is set to lowercase and when logging in as well. For registering the user, in the AccountController [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName

Claims: difference between UPN, Name with Azure AD

怎甘沉沦 提交于 2019-12-05 15:24:40
In System.IdentityModel.Claims there are three entries: UPN, Name and NameIdentifier " http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name " " http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn " " http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier " While debugging after authentication with AzureAD, OpenIdConnect and Office365. I see that name and upn are always the same, something that looks like the 'email' of a given user: e.g. johndoe@contoso.com or johdoe@contoso.onmicrosoft.com while the nameidentifier is a non human readable identifier. Then, I do have a