|
|
|
ASP.NET WebAPI Security 4 Examples for various Authentication Scenarios |
Si vous voulez bloquer ce service sur vos fils RSS
Si vous voulez nous contacter ou nous proposer un fil RSS
Menu > Articles de la revue de presse : - l'ensemble [ tous | francophone] - par mots clé [ tous] - par site [ tous] - le tagwall [ voir] - Top bi-hebdo de la revue de presse [ Voir]
ASP.NET WebAPI Security 4 Examples for various Authentication Scenarios Par www.leastprivilege.comLe [2012-03-14] à 09:28:20
Présentation : The Thinktecture.IdentityModel.Http repository includes a number of samples for the various authentication scenarios. All the clients follow a basic pattern 1. Acquire client credential a single token, multiple tokens, username password . 2. Call Service. The service simply enumerates the claims it finds on the request and returns them to the client. I won t show that part of the code, but rather focus on the step 1 and 2. Basic Authentication This is the most basic pun inteneded scenario. My library contains a class that can create the Basic Authentication header value. Simply set username and password and you are good to go. var client new HttpClient BaseAddress _baseAddress client.DefaultRequestHeaders.Authorization new BasicAuthenticationHeaderValue alice , alice var response client.GetAsync identity .Result response.EnsureSuccessStatusCode SAML Authentication To integrate a Web API with an existing enterprise identity provider like ADFS, you can use SAML tokens. This is certainly not the most efficient way of calling a lightweight service But very useful if that s what it takes to get the job done. private static string GetIdentityToken var factory new WSTrustChannelFactory new WindowsWSTrustBinding SecurityMode .Transport , _idpEndpoint factory.TrustVersion TrustVersion .WSTrust13 var rst new RequestSecurityToken RequestType RequestTypes .Issue, KeyType KeyTypes .Bearer, AppliesTo new EndpointAddress Constants .Realm var token factory.CreateChannel .Issue rst as GenericXmlSecurityToken return token.TokenXml.OuterXml private static Identity CallService string saml var client new HttpClient BaseAddress _baseAddress client.DefaultRequestHeaders.Authorization new AuthenticationHeaderValue SAML , saml var response client.GetAsync identity .Result response.EnsureSuccessStatusCode return response.Content.ReadAsAsync .Result SAML to SWT conversion using the Azure Access Control Service Another possible options for integrating SAML based identity providers is to use an intermediary service that allows converting the SAML token to the more compact SWT Simple Web Token format. This way you only need to roundtrip the SAML once and can use the SWT afterwards. The code for the conversion uses the ACS OAuth2 endpoint. The OAuth2Client class is part of my library. private static string GetServiceTokenOAuth2 string samlToken var client new OAuth2Client acsOAuth2Endpoint return client.RequestAccessTokenAssertion samlToken, SecurityTokenTypes .Saml2TokenProfile11, Constants .Realm .AccessToken SWT Authentication When you have an identity provider that directly supports a simple web token, you can acquire the token directly without the conversion step. Thinktecture.IdentityServer e.g. supports the OAuth2 resource owner credential profile to issue SWT tokens. private static string GetIdentityToken var client new OAuth2Client oauth2Address var response client.RequestAccessTokenUserName bob , abc 123 , Constants .Realm return response.AccessToken private static Identity CallService string swt var client new HttpClient BaseAddress _baseAddress client.DefaultRequestHeaders.Authorization new AuthenticationHeaderValue Bearer , swt var response client.GetAsync identity .Result response.EnsureSuccessStatusCode return response.Content.ReadAsAsync .Result So you can see that it s pretty straightforward to implement various authentication scenarios using WebAPI and my authentication library. Stay tuned for more client samples
Les mots clés de la revue de presse pour cet article : security authentication Les videos sur SecuObs pour les mots clés : security authentication Les mots clés pour les articles publiés sur SecuObs : security Les éléments de la revue Twitter pour les mots clé : security authentication
Les derniers articles du site "www.leastprivilege.com" :
- Moving to a new Blog - API for the X509 Certificate Store - Thinktecture.IdentityModel.Http and the ASP.NET Web API CodePlex bits - Identity in .NET 4.5Part 4 Claims over Kerberos - Thinktecture IdentityServer and Contrib Project now on GitHub - Identity in .NET 4.5Part 3 Breaking changes - Identity in .NET 4.5Part 2 Claims Transformation in ASP.NET Beta 1 - Identity in .NET 4.5Part 1 Status Quo Beta 1 - ASP.NET WebAPI Security 5 JavaScript Clients - ASP.NET WebAPI Security 4 Examples for various Authentication Scenarios
Menu > Articles de la revue de presse : - l'ensemble [ tous | francophone] - par mots clé [ tous] - par site [ tous] - le tagwall [ voir] - Top bi-hebdo de la revue de presse [ Voir]
Si vous voulez bloquer ce service sur vos fils RSS :
- avec iptables "iptables -A INPUT -s 88.190.17.190 --dport 80 -j DROP"
- avec ipfw et wipfw "ipfw add deny from 88.190.17.190 to any 80"
- Nous contacter par mail
| Mini-Tagwall des articles publiés sur SecuObs : | | | | sécurité, exploit, windows, attaque, outil, microsoft, réseau, audit, metasploit, vulnérabilité, système, virus, internet, usbsploit, données, source, linux, protocol, présentation, scanne, réseaux, scanner, bluetooth, conférence, reverse, shell, meterpreter, vista, rootkit, détection, mobile, security, malicieux, engineering, téléphone, paquet, trames, https, noyau, utilisant, intel, wishmaster, google, sysun, libre |
| Mini-Tagwall de l'annuaire video : | | | | curit, security, biomet, metasploit, biometric, cking, password, windows, botnet, defcon, tutorial, crypt, xploit, exploit, lockpicking, linux, attack, wireshark, vmware, rootkit, conference, network, shmoocon, backtrack, virus, conficker, elcom, etter, elcomsoft, server, meterpreter, openvpn, ettercap, openbs, iphone, shell, openbsd, iptables, securitytube, deepsec, source, office, systm, openssh, radio |
| Mini-Tagwall des articles de la revue de presse : | | | | security, microsoft, windows, hacker, attack, network, vulnerability, google, exploit, malware, internet, remote, iphone, server, inject, patch, apple, twitter, mobile, virus, ebook, facebook, vulnérabilité, crypt, source, linux, password, intel, research, virtual, phish, access, tutorial, trojan, social, privacy, firefox, adobe, overflow, office, cisco, conficker, botnet, pirate, sécurité |
| Mini-Tagwall des Tweets de la revue Twitter : | | | | security, linux, botnet, attack, metasploit, cisco, defcon, phish, exploit, google, inject, server, firewall, network, twitter, vmware, windows, microsoft, compliance, vulnerability, python, engineering, source, kernel, crypt, social, overflow, nessus, crack, hacker, virus, iphone, patch, virtual, javascript, malware, conficker, pentest, research, email, password, adobe, apache, proxy, backtrack |
|
|
|
|
|