예제 #1
0
 public void Constructor(byte[] key, EE ee)
 {
     try
     {
         var symmetricSecurityKey = new SymmetricSecurityKey(key);
         ee.ProcessNoException();
     }
     catch (Exception exception)
     {
         ee.ProcessException(exception);
     }
 }
 public SignatureProviderTheoryData(string testId, string signingAlgorithm, string verifyAlgorithm, SecurityKey signingKey, SecurityKey verifyKey, EE expectedException = null)
 {
     SigningAlgorithm  = signingAlgorithm;
     VerifyAlgorithm   = verifyAlgorithm;
     SigningKey        = signingKey;
     VerifyKey         = verifyKey;
     ExpectedException = expectedException ?? EE.NoExceptionExpected;
     TestId            = testId;
 }
 public CryptoProviderFactoryTheoryData(string testId, string algorithm, SecurityKey signingKey, SecurityKey verifyKey, EE expectedException = null)
 {
     SigningAlgorithm  = algorithm;
     SigningKey        = signingKey;
     VerifyKey         = verifyKey;
     ExpectedException = expectedException ?? EE.NoExceptionExpected;
     TestId            = testId;
 }
        public static ClaimsPrincipal ValidateToken(string securityToken, TokenValidationParameters validationParameters, ISecurityTokenValidator tokenValidator, ExpectedException expectedException)
        {
            ClaimsPrincipal retVal = null;

            try
            {
                retVal = tokenValidator.ValidateToken(securityToken, validationParameters, out SecurityToken validatedToken);
                expectedException.ProcessNoException();
            }
            catch (Exception ex)
            {
                expectedException.ProcessException(ex);
            }

            return(retVal);
        }