本文整理匯總了C#中System.IdentityModel.Configuration.SecurityTokenServiceConfiguration類的典型用法代碼示例。如果您正苦於以下問題:C# SecurityTokenServiceConfiguration類的具體用法?C# SecurityTokenServiceConfiguration怎麽用?C# SecurityTokenServiceConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SecurityTokenServiceConfiguration類屬於System.IdentityModel.Configuration命名空間,在下文中一共展示了SecurityTokenServiceConfiguration類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: object
namespace PassiveSTS
{
/// <summary>
/// Extends the Microsoft.IdentityModel.Services.SecurityTokenServiceConfiguration class to
/// be consumed by the CustomSecurityTokenService.
/// </summary>
public class CustomSecurityTokenServiceConfiguration : SecurityTokenServiceConfiguration
{
static readonly object syncRoot = new object();
static string CustomSecurityTokenServiceConfigurationKey = "CustomSecurityTokenServiceConfigurationKey";
static string Base64SymmetricKey = "wAVkldQiFypTQ+kdNdGWCYCHRcee8XmXxOvgmak8vSY=";
public static CustomSecurityTokenServiceConfiguration Current
{
get
{
HttpApplicationState httpAppState = HttpContext.Current.Application;
CustomSecurityTokenServiceConfiguration myConfiguration = httpAppState.Get( CustomSecurityTokenServiceConfigurationKey ) as CustomSecurityTokenServiceConfiguration;
if ( myConfiguration != null )
{
return myConfiguration;
}
lock ( syncRoot )
{
myConfiguration = httpAppState.Get( CustomSecurityTokenServiceConfigurationKey ) as CustomSecurityTokenServiceConfiguration;
if ( myConfiguration == null )
{
myConfiguration = new CustomSecurityTokenServiceConfiguration();
httpAppState.Add( CustomSecurityTokenServiceConfigurationKey, myConfiguration );
}
return myConfiguration;
}
}
}
public CustomSecurityTokenServiceConfiguration()
: base( "PassiveSTS" )
{
this.SecurityTokenService = typeof( PassiveSTS.CustomSecurityTokenService );
SimpleWebTokenHandler tokenHandler = new SimpleWebTokenHandler();
this.SecurityTokenHandlers.Add(tokenHandler);
CustomIssuerTokenResolver customTokenResolver = new SimpleWebToken.CustomIssuerTokenResolver();
customTokenResolver.AddAudienceKeyPair("http://localhost:19851/", Base64SymmetricKey);
this.IssuerTokenResolver = customTokenResolver;
this.DefaultTokenType = SimpleWebTokenHandler.SimpleWebTokenTypeUri;
}
}
}
開發者ID:.NET開發者,項目名稱:System.IdentityModel.Configuration,代碼行數:55,代碼來源:SecurityTokenServiceConfiguration
示例2: Page_PreRender
//引入命名空間
using System;
using System.IdentityModel.Services;
using System.Security.Claims;
namespace PassiveSTS
{
public partial class _Default : System.Web.UI.Page
{
/// <summary>
/// We perform the WS-Federation Passive Protocol processing in this method.
/// </summary>
protected void Page_PreRender( object sender, EventArgs e )
{
FederatedPassiveSecurityTokenServiceOperations.ProcessRequest( Request, User as ClaimsPrincipal, CustomSecurityTokenServiceConfiguration.Current.CreateSecurityTokenService(), Response );
}
}
}
開發者ID:.NET開發者,項目名稱:System.IdentityModel.Configuration,代碼行數:18,代碼來源:SecurityTokenServiceConfiguration