This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schemas.xmlsoap.org/ws/2005/05/identity/claims/name | |
schemas.microsoft.com/ws/2008/06/identity/claims/role | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/surname | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/locality | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/gender | |
schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<httpRuntime requestValidationMode="2.0"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_Start() | |
{ | |
... | |
FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated; | |
} | |
private void OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e) | |
{ | |
FederatedAuthentication.WSFederationAuthenticationModule.SignedIn += new EventHandler(WSFederationAuthenticationModule_SignedIn); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ClaimCollection GetClaims() | |
{ | |
var claimsPrincipal = Thread.CurrentPrincipal as IClaimsPrincipal; | |
var claimsIdentity = (IClaimsIdentity)claimsPrincipal.Identity; | |
return claimsIdentity.Claims; | |
} | |
private string GetClaimValue(ClaimCollection claims, string claim) | |
{ | |
var claimRecord = claims.FirstOrDefault(o => o.ClaimType == claim); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Display() | |
{ | |
var claims = GetClaims(); | |
var user = new UserInfo(); | |
user.NameIdentifier = GetClaimValue(claims, "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"); | |
user.Name = GetClaimValue(claims, "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"); | |
user.StreetAddress = GetClaimValue(claims, "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress"); | |
user.Nationality = GetClaimValue(claims, "be:fedict:eid:idp:nationality"); | |
user.POB = GetClaimValue(claims, "be:fedict:eid:idp:pob"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img style="float: right;" src="/Account/Photo" alt="" width="140" height="200" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Photo() | |
{ | |
var photo = GetClaims().FirstOrDefault(o => o.ClaimType == "be:fedict:eid:idp:photo"); | |
if (photo != null) | |
{ | |
var stream = new MemoryStream(Convert.FromBase64String(photo.Value)); | |
return new FileStreamResult(stream, "image/jpg"); | |
} | |
else | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.web> | |
<pages validateRequest="false" > | |
... | |
</pages> | |
<!-- For .NET 4.0 --> | |
<httpRuntime requestValidationMode="2.0" /> | |
</system.web> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web; | |
using System.Web.Util; | |
using Microsoft.IdentityModel.Protocols.WSFederation; | |
namespace Sandrino.SomeAzureApplication | |
{ | |
public class AccessControlRequestValidator : RequestValidator | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.web> | |
<httpRuntime requestValidationType= | |
"Sandrino.SomeAzureApplication.AccessControlRequestValidator"/> | |
</system.web> |
OlderNewer