Examples of JWSBuilder


Examples of org.jboss.resteasy.jose.jws.JWSBuilder

      token.addAccess("bar").addRole("user");

      KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
      byte[] tokenBytes = JsonSerialization.toByteArray(token, true);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(keyPair.getPrivate());

      System.out.println(encoded);
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testSimpleVerification() throws Exception
   {

      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());
      SkeletonKeyToken token =  RSATokenVerifier.verifyToken(encoded, metadata);
      Assert.assertTrue(token.getResourceAccess("service").getRoles().contains("admin"));
      Assert.assertEquals("CN=Client", token.getPrincipal());
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testBadSignature() throws Exception
   {

      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(badPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testNotBeforeGood() throws Exception
   {
      token.notBefore((System.currentTimeMillis()/1000) - 100);
      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testNotBeforeBad() throws Exception
   {
      token.notBefore((System.currentTimeMillis()/1000) + 100);
      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testExpirationGood() throws Exception
   {
      token.expiration((System.currentTimeMillis()/1000) + 100);
      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

   public void testExpirationBad() throws Exception
   {
      token.expiration((System.currentTimeMillis()/1000) - 100);
      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

      token.principal("CN=Client")
              .audience("domain")
              .addAccess("service").addRole("admin").verifyCaller(true);
      byte[] tokenBytes = JsonSerialization.toByteArray(token, false);

      String encoded = new JWSBuilder()
              .content(tokenBytes)
              .rsa256(idpPair.getPrivate());

      SkeletonKeyToken v = null;
      try
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
      return new JWSBuilder()
              .content(tokenBytes)
              .rsa256(privateKey);
   }
View Full Code Here

Examples of org.jboss.resteasy.jose.jws.JWSBuilder

      accessCodeMap.put(code.getId(), code);
      log.debug("--- sign access code");
      String accessCode = null;
      try
      {
         accessCode = new JWSBuilder().content(code.getId().getBytes("UTF-8")).rsa256(realmPrivateKey);
      }
      catch (UnsupportedEncodingException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.