示例#1
0
 public SymmetricKeyTokenGenerator(
     TokenGeneratorSettings settings,
     TokenValidatorSettings validatorSettings)
     : base(settings, validatorSettings)
 {
     signatureKey = new SymmetricSecurityKey(Convert.FromBase64String(settings.Secret));
 }
示例#2
0
 protected TokenGenerator(
     TokenGeneratorSettings settings,
     TokenValidatorSettings validatorSettings)
 {
     Settings           = settings;
     _validatorSettings = validatorSettings;
     handler            = new JwtSecurityTokenHandler {
         SetDefaultTimesOnTokenCreation = false
     };
 }
示例#3
0
        public AsymmetricKeyPairTokenGenerator(
            TokenGeneratorSettings settings,
            TokenValidatorSettings validatorSettings)
            : base(settings, validatorSettings)
        {
            publicKeyRsaProvider = new RSACryptoServiceProvider(KeySize);
            publicKeyRsaProvider.FromXmlString(
                Encoding.UTF8.GetString(
                    Convert.FromBase64String(settings.Public)));
            publicSecurityKey = new RsaSecurityKey(publicKeyRsaProvider);

            privateKeyRsaProvider = new RSACryptoServiceProvider(KeySize);
            privateKeyRsaProvider.FromXmlString(
                Encoding.UTF8.GetString(
                    Convert.FromBase64String(settings.Private)));
            privateSecurityKey = new RsaSecurityKey(privateKeyRsaProvider);
        }