Package com.nimbusds.jose.crypto

Examples of com.nimbusds.jose.crypto.MACSigner


      } else if (jwk instanceof OctetSequenceKey) {
        // build HMAC signers & verifiers

        if (jwk.isPrivate()) { // technically redundant check because all HMAC keys are private
          MACSigner signer = new MACSigner(((OctetSequenceKey) jwk).toByteArray());
          signers.put(id, signer);
        }

        MACVerifier verifier = new MACVerifier(((OctetSequenceKey) jwk).toByteArray());
        verifiers.put(id, verifier);
View Full Code Here


    // Create JWS object
    JWSObject jwsObject = new JWSObject(header, new Payload(jwtClaims.toJSONObject()));

    // Create HMAC signer
    JWSSigner signer = new MACSigner(SHARED_KEY.getBytes());

    try {
      jwsObject.sign(signer);
    } catch(com.nimbusds.jose.JOSEException e) {
      System.err.println("Error signing JWT: " + e.getMessage());
View Full Code Here

    Base64URL signingInput = Base64URL.encode(jwsObject.getSigningInput());

    assertTrue(signingInput.equals(Base64URL.encode(jwsObject.getSigningInput())));

    jwsObject.sign(new MACSigner("1234567890abc"));

    String output = jwsObject.serialize();

    assertEquals(output, jwsObject.serialize());
  }
View Full Code Here

    Secret secret = new Secret();

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);

    jwt.sign(new MACSigner(secret.getValueBytes()));

    UserInfoSuccessResponse response = new UserInfoSuccessResponse(jwt);

    assertEquals(jwt, response.getUserInfoJWT());
    assertEquals("application/jwt; charset=UTF-8", response.getContentType().toString());
View Full Code Here

    claimsSet.setExpirationTime(new Date(20000l));
    claimsSet.setClaim("nonce", "123");

    SignedJWT idToken = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);

    idToken.sign(new MACSigner("1234567890abcdef"));

    AuthenticationSuccessResponse response = new AuthenticationSuccessResponse(
      REDIRECT_URI, null, idToken, null, new State("abc"));

    assertEquals(REDIRECT_URI, response.getRedirectionURI());
View Full Code Here

    claimsSet.setExpirationTime(new Date(20000l));
    claimsSet.setClaim("nonce", "123");

    SignedJWT idToken = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);

    idToken.sign(new MACSigner("1234567890abcdef"));

    AuthenticationSuccessResponse response = new AuthenticationSuccessResponse(
      REDIRECT_URI, code, idToken, null, new State("abc"));

    assertEquals(REDIRECT_URI, response.getRedirectionURI());
View Full Code Here

    JWTClaimsSet claimsSet = new JWTClaimsSet();
    claimsSet.setIssuer("https://c2id.com");

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);
    jwt.sign(new MACSigner("abcdef1234567890"));

    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

  public void testRejectSoftwareStatementWithoutIssuer()
    throws Exception {

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), new JWTClaimsSet());
    jwt.sign(new MACSigner("abcdef1234567890"));

    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

    SignedJWT jwt = new SignedJWT(jwsHeader, assertion.toJWTClaimsSet());

    Secret secret = new Secret();

    MACSigner signer = new MACSigner(secret.getValueBytes());

    jwt.sign(signer);

    ClientSecretJWT clientSecretJWT = new ClientSecretJWT(jwt);
View Full Code Here

    JWTClaimsSet claimsSet = new JWTClaimsSet();
    claimsSet.setIssuer("https://c2id.com");

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);
    jwt.sign(new MACSigner("abcdef1234567890"));

    ClientMetadata metadata = new ClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

TOP

Related Classes of com.nimbusds.jose.crypto.MACSigner

Copyright © 2018 www.massapicom. 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.