public virtual void SetUp() { du = new DateUtil(); guid = new GUID(); keyGenerator = new SymmetricKeyGenerator(); jwt = new JWTCreator(); options = new JWTOptions(); claims = new PrivateClaims(); options.AddRegisteredClaim("iss", "GXSA"); options.AddRegisteredClaim("sub", "subject1"); options.AddRegisteredClaim("aud", "audience1"); options.AddRegisteredClaim("jti", guid.Generate()); options.AddCustomTimeValidationClaim("exp", du.CurrentPlusSeconds(100), "20"); options.AddCustomTimeValidationClaim("iat", du.GetCurrentDate(), "20"); options.AddCustomTimeValidationClaim("nbf", du.GetCurrentDate(), "20"); claims.setClaim("hola1", "hola1"); claims.setClaim("hola2", "hola2"); path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); path_RSA_sha256_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_2048"); path_RSA_sha512_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha512_2048"); path_EC = Path.Combine(BASE_PATH, "dummycerts", "JWT_ECDSA", "prime_test"); alias = "1"; password = "******"; }
public virtual void SetUp() { jwt = new JWTCreator(); options = new JWTOptions(); du = new DateUtil(); keyGen = new SymmetricKeyGenerator(); claims = new PrivateClaims(); currentDate = du.GetCurrentDate(); hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); options.AddRegisteredClaim("aud", "jitsi"); options.AddRegisteredClaim("iss", "my_client"); options.AddRegisteredClaim("sub", "meet.jit.si"); string expiration = du.CurrentPlusSeconds(200); options.AddCustomTimeValidationClaim("exp", expiration, "20"); claims.setClaim("hola", "hola"); options.AddHeaderParameter("cty", "twilio-fpa;v=1"); options.SetSecret(hexaKey); token = jwt.DoCreate("HS256", claims, options); }
public virtual void SetUp() { cert = new CertificateX509(); key = new PrivateKeyManager(); options = new JWTOptions(); claims = new PrivateClaims(); du = new DateUtil(); jwt = new JWTCreator(); cert.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256_cert.crt"); options.SetCertificate(cert); key.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256d_key.pem"); options.SetPrivateKey(key); // // carga de privateClaim (es parte del Payload) claims.setClaim("GeneXus", "Viglia"); // Carga de Registered Claims options.AddRegisteredClaim("iss", "Martin"); options.AddRegisteredClaim("sub", "Martin1"); options.AddRegisteredClaim("aud", "martivigliadoocebbooyo.docebosaas.com"); options.AddCustomTimeValidationClaim("iat", du.GetCurrentDate(), "20"); options.AddCustomTimeValidationClaim("exp", du.CurrentPlusSeconds(3600), "20"); options.AddPublicClaim("client_id", "Martin"); token = jwt.DoCreate("RS256", claims, options); expected = "{\"alg\":\"RS256\",\"typ\":\"JWT\"}"; }