Class SignJWTHandler

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • jwtUpdateConsumer

        @NonnullAfterInit
        private BiConsumer<com.nimbusds.jwt.JWT,​MessageContext> jwtUpdateConsumer
        A consumer that takes the Signed JWT and updates the correct object inside the MessageContext.
      • signatureSigningParameters

        @Nonnull
        private SignatureSigningParameters signatureSigningParameters
        The signature signing parameters.
      • credential

        @Nullable
        private Credential credential
        resolved credential.
      • jwtClaimSetToSign

        @Nullable
        private com.nimbusds.jwt.JWTClaimsSet jwtClaimSetToSign
        The claims to sign.
      • typeHeader

        @Nullable
        @NotEmpty
        private String typeHeader
        "typ" header to insert while signing.
      • logName

        @Nonnull
        @NotEmpty
        private String logName
        A friendly name to log as the subject of signing.
    • Constructor Detail

      • SignJWTHandler

        public SignJWTHandler()
        Constructor.
    • Method Detail

      • setLogName

        public void setLogName​(@Nonnull @NotEmpty
                               String name)
        Set the friendly name to log as the subject of signing.
        Parameters:
        name - the friendly name
      • setClaimsToSignLookupStrategy

        public void setClaimsToSignLookupStrategy​(@Nonnull
                                                  Function<MessageContext,​com.nimbusds.jwt.JWTClaimsSet> strategy)
        Set the strategy used to locate the JWTClaimsSet to sign.
        Parameters:
        strategy - the strategy
      • setJwtUpdateConsumer

        public void setJwtUpdateConsumer​(BiConsumer<com.nimbusds.jwt.JWT,​MessageContext> consumer)
        Set the consumer used to update the MessageContext with the supplied EncryptedJWT.
        Parameters:
        consumer - the consumer
      • setTypeHeader

        public void setTypeHeader​(@Nullable @NotEmpty
                                  String type)
        Sets the value to be inserted as a "typ" header for the JWS.
        Parameters:
        type - header value
      • getSigner

        private com.nimbusds.jose.JWSSigner getSigner​(com.nimbusds.jose.Algorithm jwsAlgorithm)
                                               throws com.nimbusds.jose.JOSEException
        Returns correct implementation of signer based on algorithm type.
        Parameters:
        jwsAlgorithm - JWS algorithm
        Returns:
        signer for algorithm and private key
        Throws:
        com.nimbusds.jose.JOSEException - if algorithm cannot be supported
      • resolveAlgorithm

        protected com.nimbusds.jose.JWSAlgorithm resolveAlgorithm()
        Resolves JWS algorithm from signature signing parameters.
        Returns:
        JWS algorithm