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
ServiceHost service = new ServiceHost(typeof(Calculator)); | |
Binding currentBinding = service.Description.Endpoints[0].Binding; |
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
// Set the maximum difference in minutes | |
int maxDifference = 300; | |
// Create a custom binding based on an existing binding | |
CustomBinding myCustomBinding = new CustomBinding(currentBinding); | |
// Set the maxClockSkew | |
var security = myCustomBinding.Elements.Find<SymmetricSecurityBindingElement>(); | |
security.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); | |
security.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); |
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
DefaultLookAndFeel defaultSkin = new DefaultLookAndFeel(); | |
defaultSkin.LookAndFeel.SetSkinStyle("Seven"); |
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 (var site = new SPSite("http://localhost")) | |
{ | |
// Get context for the site. | |
var context = SPServiceContext.GetContext(site); | |
// Assign context in SPServiceContext.Current | |
using (var scope = new SPServiceContextScope(context)) | |
{ | |
... | |
entity.FindFiltered(...); |