Class NimbusClientSupport

java.lang.Object
net.shibboleth.idp.plugin.authn.duo.nimbus.impl.NimbusClientSupport

@ThreadSafe public final class NimbusClientSupport extends Object
Helper methods for working with Duo using Nimbus.
  • Constructor Details

    • NimbusClientSupport

      private NimbusClientSupport()
      private constructor.
  • Method Details

    • generateJWTId

      @Nonnull static String generateJWTId(@Nonnull Integer length)
      Generate a cryptographically strong random JWT identifier.
      Parameters:
      length - the length of the ID. Can not be null.
      Returns:
      a cryptographically strong random JWT identifier.
    • createJWSRequestObject

      @Nonnull static String createJWSRequestObject(@Nonnull @NotEmpty String clientID, @Nonnull @NotEmpty String redirectURI, @Nonnull @NotEmpty String secret, @Nonnull @NotEmpty String state, @Nonnull @NotEmpty String username) throws DuoClientException
      Create a signed JWT Request object using the given parameters suitable for the Duo token endpoint.

      Only supports the HS512 JWS algorithm.

      Parameters:
      clientID - the client identifier
      redirectURI - the redirectURI
      secret - the client secret
      state - the state
      username - the subject of the authentication
      Returns:
      a signed JWT
      Throws:
      DuoClientException - on error constructing the JWS request object
    • createJWS

      @Nonnull static String createJWS(@Nonnull String aud, @Nonnull String clientID, @Nonnull String secret) throws DuoClientException
      Create a signed JWT using the audience and client ID supplied.

      Only supports the HS512 JWS algorithm.

      Parameters:
      aud - the audience of the JWT.
      clientID - the client identifier
      secret - the client secret
      Returns:
      a signed JWT.
      Throws:
      DuoClientException - on error constructing the JWS object