Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var handler = new AccessSecurityTokenHandler()
            {
                Configuration = new SecurityTokenHandlerConfiguration()
            };

            ConfigureHandler(handler.Configuration);

            var token       = CreateToken(handler);
            var tokenString = WriteToken(handler, token);

            Console.WriteLine(tokenString.ToString());
            Console.WriteLine("\nFull Length      : {0}", tokenString.Length);
            Console.WriteLine("Compressed Length: {0}\n", Compress(tokenString.ToString()).Length);

            var readToken = ReadToken(handler, tokenString.ToString());

            var identities = handler.ValidateToken(readToken);

            ClaimsViewer.ShowConsole(new ClaimsPrincipal(identities));

            TestHandlerCollection(tokenString);
            TestMalformedTokens();
            TestCompressedToken(token);
        }
Exemplo n.º 2
0
        public string Ping(string data)
        {
            var principal = Thread.CurrentPrincipal.AsClaimsPrincipal();

            ClaimsViewer.ShowConsole(principal);

            return("success");
        }
        private static void SymmetricEncrypted()
        {
            var token = RequestSymmetricEncryptedToken(signingCert);

            var principal = token.ToClaimsPrincipal(signingCert);

            "\nSymmetric Encrypted\n".ConsoleRed();
            ClaimsViewer.ShowConsole(principal);
        }
        private static void BearerClearText()
        {
            var token = RequestBearerClearTextToken();

            var principal = token.ToClaimsPrincipal(signingCert);

            "\nBearerClearText\n".ConsoleRed();
            ClaimsViewer.ShowConsole(principal);
        }
 public void ShowClaims()
 {
     Console.WriteLine("\n--ShowClaims called");
     ClaimsViewer.ShowConsole(Thread.CurrentPrincipal.AsClaimsPrincipal());
 }