Exemple #1
0
        public static bool TryParseBody(X509Certificate2 cert, string token, out AccessTokenBody body)
        {
            AccessToken accessToken;

            if (TryParse(token, out accessToken) == false)
            {
                body = null;
                return(false);
            }

            if (accessToken.MatchesSignature(cert) == false)
            {
                body = null;
                return(false);
            }

            try
            {
                body = JsonConvert.DeserializeObject <AccessTokenBody>(accessToken.Body);
                return(true);
            }
            catch
            {
                body = null;
                return(false);
            }
        }
Exemple #2
0
		public static bool TryParseBody(X509Certificate2 cert, string token, out AccessTokenBody body)
		{
			AccessToken accessToken;
			if (TryParse(token, out accessToken) == false)
			{
				body = null;
				return false;
			}

			if (accessToken.MatchesSignature(cert) == false)
			{
				body = null;
				return false;
			}

			try
			{
				body = JsonConvert.DeserializeObject<AccessTokenBody>(accessToken.Body);
				return true;
			}
			catch
			{
				body = null;
				return false;
			}
		}
Exemple #3
0
 public OAuthPrincipal(AccessTokenBody tokenBody)
 {
     this.tokenBody = tokenBody;
 }
		public OAuthPrincipal(AccessTokenBody tokenBody)
		{
			this.tokenBody = tokenBody;
		}