use of org.jose4j.jwt.JwtClaims in project light-4j by networknt.
the class JwtIssuerTest method AcGroupAccessControlWrong.
/**
* The returned token contains scopes for access-control example
* @throws Exception
*/
@Test
public void AcGroupAccessControlWrong() throws Exception {
JwtClaims claims = ClaimsUtil.getTestClaimsGroup("stevehu", "EMPLOYEE", "f7d42348-c647-4efb-a52d-4c5787421e72", Arrays.asList("account.r", "account.w"), "backOffice");
claims.setExpirationTimeMinutesInTheFuture(5256000);
String jwt = JwtIssuer.getJwt(claims);
System.out.println("***Long lived token Authorization code customer with roles***: " + jwt);
}
use of org.jose4j.jwt.JwtClaims in project light-4j by networknt.
the class JwtIssuerTest method longlivedLightPortalController.
@Test
public void longlivedLightPortalController() throws Exception {
JwtClaims claims = ClaimsUtil.getTestClaims("stevehu@gmail.com", "EMPLOYEE", "f7d42348-c647-4efb-a52d-4c5787421e73", Arrays.asList("portal.r", "portal.w"), "user CtlPltAdmin CtlPltRead CtlPltWrite");
claims.setExpirationTimeMinutesInTheFuture(5256000);
String jwt = JwtIssuer.getJwt(claims);
System.out.println("***Long lived token for portal controller ***: " + jwt);
}
use of org.jose4j.jwt.JwtClaims in project light-4j by networknt.
the class JwtIssuerTest method sidecarReferenceBootstrap.
/**
* This token is used to connect to the light-config-server with serviceId 0100 for testing with a service specific for a client.
* @throws Exception
*/
@Test
public void sidecarReferenceBootstrap() throws Exception {
JwtClaims claims = ClaimsUtil.getTestCcClaimsScopeService("f7d42348-c647-4efb-a52d-4c5787421e72", "portal.r portal.w", "0100");
claims.setExpirationTimeMinutesInTheFuture(5256000);
String jwt = JwtIssuer.getJwt(claims);
System.out.println("***Reference Long lived Bootstrap token for config server and controller: " + jwt);
}
use of org.jose4j.jwt.JwtClaims in project light-4j by networknt.
the class JwtIssuerTest method longlivedCcLocalProxyWithScp.
/**
* The returned token contains scp as the key for the scope. Some OAuth 2.0 provider like Okta use this claim. All scopes are separated by comma.
* The token will have proxy.r and proxy.w as scopes for testing with proxy configuration in light-config-test proxy folder.
* @throws Exception
*/
@Test
public void longlivedCcLocalProxyWithScp() throws Exception {
JwtClaims claims = ClaimsUtil.getTestCcClaimsWithScp("f7d42348-c647-4efb-a52d-4c5787421e73", Arrays.asList("proxy.r", "proxy.w"));
claims.setExpirationTimeMinutesInTheFuture(5256000);
String jwt = JwtIssuer.getJwt(claims);
System.out.println("***Long lived token for proxy***: " + jwt);
}
use of org.jose4j.jwt.JwtClaims in project light-4j by networknt.
the class JwtIssuerTest method longLivedProductSubjectJwt.
@Test
public void longLivedProductSubjectJwt() throws Exception {
Map<String, String> custom = new HashMap<>();
custom.put("consumer_application_id", "361");
custom.put("request_transit", "67");
JwtClaims claims = ClaimsUtil.getCustomClaims("steve", "EMPLOYEE", "f7d42348-c647-4efb-a52d-4c5787421e72", null, custom, "user");
claims.setExpirationTimeMinutesInTheFuture(5256000);
String jwt = JwtIssuer.getJwt(claims);
System.out.println("***LongLived product subject JWT***: " + jwt);
}
Aggregations