Exemplo n.º 1
0
        public void WhenBuildClaimToken(Table table)
        {
            var jwsPayload = new JwsPayload();

            foreach (var record in table.Rows)
            {
                var key   = record["Key"];
                var value = record["Value"];
                if (value.StartsWith('[') && value.EndsWith(']'))
                {
                    value = value.TrimStart('[').TrimEnd(']');
                    var splitted = value.Split(',');
                    jwsPayload.Add(key, JArray.FromObject(splitted));
                }
                else
                {
                    jwsPayload.Add(key, value);
                }
            }

            var jwtBuilder = (IJwtBuilder)_factory.Server.Host.Services.GetService(typeof(IJwtBuilder));
            var jws        = jwtBuilder.Sign(jwsPayload, JwksStore.GetInstance().GetJsonWebKey());

            _scenarioContext.Set(jws, "claim_token");
        }
Exemplo n.º 2
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     services.AddAuthorization(p => p.AddDefaultOAUTHAuthorizationPolicy());
     services.AddSIDUma(o =>
     {
         o.OpenIdJsonWebKeySignature = JwksStore.GetInstance().GetJsonWebKey();
     });
 }
Exemplo n.º 3
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc(o =>
     {
         o.EnableEndpointRouting = false;
     }).AddApplicationPart(typeof(RegistrationController).Assembly)
     .AddApplicationPart(typeof(PermissionsAPIController).Assembly)
     .AddNewtonsoftJson(o => { });
     services.AddAuthorization(p => p.AddDefaultOAUTHAuthorizationPolicy());
     services.AddSIDUma(o =>
     {
         o.OpenIdJsonWebKeySignature = JwksStore.GetInstance().GetJsonWebKey();
     });
 }