コード例 #1
0
        public SimpleStsConfiguration(IRelyingParty rp)
            : base(rp.IssuerName)
        {
            RelyingParty         = rp;
            SecurityTokenService = typeof(SimpleSts);

            SecurityTokenHandlers.Clear();
            SecurityTokenHandlers.Add(TokenTypes.GetSecurityTokenHandler(rp.TokenType));


            ServiceCertificate = rp.GetEncryptingCertificate();
            if (ServiceCertificate != null)
            {
                SecurityTokenHandlers.Add(new EncryptedSecurityTokenHandler());
            }
        }
        /// <summary>
        /// Creates configuration for the basic security token service.
        /// </summary>
        public BasicSecurityTokenServiceConfiguration() :
            base(ConfigurationProvider.Instance.IssuerTokenName.Uri.AbsoluteUri)
        {
            DisableWsdl         = true;
            SaveBootstrapTokens = true;
            TokenIssuerName     = ConfigurationProvider.Instance.IssuerTokenName.Uri.AbsoluteUri;
            SigningCredentials  = new X509SigningCredentials(CertificateHelper.GetCertificate(StoreName.My, StoreLocation.LocalMachine, ConfigurationProvider.Instance.SigningCertificate.SubjetName));

            var userNameSecurityTokenHandler = SecurityTokenHandlers.OfType <UserNameSecurityTokenHandler>().FirstOrDefault();

            while (userNameSecurityTokenHandler != null)
            {
                SecurityTokenHandlers.Remove(userNameSecurityTokenHandler);
                userNameSecurityTokenHandler = SecurityTokenHandlers.OfType <UserNameSecurityTokenHandler>().FirstOrDefault();
            }
            SecurityTokenHandlers.Add(new UserNameAsMailAddressSecurityTokenHandler());

            SecurityTokenService = typeof(BasicSecurityTokenService);
        }
 public WsTrustOptions AddSecurityTokenHandler(Func <IServiceProvider, SecurityTokenHandler> factory, params string[] requestedTokenTypes)
 {
     SecurityTokenHandlers.Add(new SecurityTokenHandlerDescriptor(requestedTokenTypes, factory));
     return(this);
 }