Example #1
0
        public static string GetAccessToken(string issuer, string app)
        {
            List <Claim> claims = new List <Claim> {
                new Claim(AccessTokenClaimTypes.App, app, ClaimValueTypes.String, issuer)
            };
            ClaimsIdentity identity = new ClaimsIdentity("mock");

            identity.AddClaims(claims);
            ClaimsPrincipal principal = new ClaimsPrincipal(identity);
            string          token     = JwtTokenMock.GenerateToken(principal, new TimeSpan(0, 1, 5), issuer);

            return(token);
        }
Example #2
0
        public static string GetOrgToken(string org, int authenticationLevel = 4)
        {
            List <Claim> claims = new List <Claim>();
            string       issuer = "www.altinn.no";

            claims.Add(new Claim(AltinnCoreClaimTypes.Org, org, ClaimValueTypes.String, issuer));
            claims.Add(new Claim(AltinnCoreClaimTypes.AuthenticateMethod, "Mock", ClaimValueTypes.String, issuer));
            claims.Add(new Claim(AltinnCoreClaimTypes.AuthenticationLevel, authenticationLevel.ToString(), ClaimValueTypes.Integer32, issuer));

            ClaimsIdentity identity = new ClaimsIdentity("mock");

            identity.AddClaims(claims);
            ClaimsPrincipal principal = new ClaimsPrincipal(identity);
            string          token     = JwtTokenMock.GenerateToken(principal, new TimeSpan(1, 1, 1));

            return(token);
        }