First of all you need to know how to retrieve your applicationId
$w=Get-SPWebApplication("http://xxxxxxx")
$w.ID
run this in the sharepoint management shell....
it is very useful to get it and you need to retrieve it to set the membership provider in the web application configuration and in the security token service application....
to retrieve it you need the following code:
string webId = SPContext.Current.Site.WebApplication.Id.ToString("B");
and to retrieve your membership provider you can use the following code...
MembershipProvider provider = Membership.Providers["UpmProvider_" + webId];
since you have to use the claim authentication you could find useful the following function:
public static string RetrieveValueFromClaims(string claimType, string issuer)
{
// Find Email from claims
Microsoft.IdentityModel.Claims.ClaimsIdentity identity =
(Microsoft.IdentityModel.Claims.ClaimsIdentity)System.Threading.Thread.CurrentPrincipal.Identity;
if (identity != null)
{
foreach (Microsoft.IdentityModel.Claims.Claim claim in identity.Claims)
{
if (claim.ClaimType.Equals(claimType, StringComparison.OrdinalIgnoreCase)
&& claim.Issuer.Equals(issuer, StringComparison.OrdinalIgnoreCase))
{
return claim.Value;
}
}
}
return null;
}
to retrieve the username of the logged user....
17 Aug 2010
Sharepoint 2010 Tips for Commerce Server 2009
Posted by
Stelio Di Bello
at
Tuesday, August 17, 2010
Tags:
claimsAuthenthication,
Commerce Server,
CS 2009,
sharepoint,
sharepoit 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment