Class BaseService

    • Field Detail

      • httpService

        @Inject
        protected io.jans.configapi.core.service.ConfigHttpService httpService
      • mapper

        protected com.fasterxml.jackson.databind.ObjectMapper mapper
      • TLS_ENABLED_PROTOCOLS

        protected static final String[] TLS_ENABLED_PROTOCOLS
      • TLS_ALLOWED_CIPHER_SUITES

        protected static final String[] TLS_ALLOWED_CIPHER_SUITES
    • Constructor Detail

      • BaseService

        public BaseService()
    • Method Detail

      • getToken

        public io.jans.as.client.TokenResponse getToken​(io.jans.as.client.TokenRequest tokenRequest,
                                                        String tokenEndpoint)
        Obtain an access token from the authorization server using the provided token request.
        Parameters:
        tokenRequest - the token request parameters (may include grant type, code, verifier, client credentials, etc.)
        tokenEndpoint - the token endpoint URL to send the request to
        Returns:
        a TokenResponse containing the token data on success, or null on failure
      • getToken

        public io.jans.as.client.TokenResponse getToken​(io.jans.as.client.TokenRequest tokenRequest,
                                                        String tokenEndpoint,
                                                        String userInfoJwt)
        Sends a token request to the specified token endpoint using values from the provided TokenRequest.

        Constructs a form from the token request fields (code, scope, code_verifier, grant_type, redirect_uri, client_id) and includes the optional `ujwt` parameter when `userInfoJwt` is provided, then POSTs the form to `tokenEndpoint` using the credentials from `tokenRequest`.

        Parameters:
        tokenRequest - values used to build the token request (authorization code, PKCE verifier, grant type, redirect URI, client id, and encoded credentials)
        tokenEndpoint - URL of the authorization server token endpoint
        userInfoJwt - optional JWT to include as the `ujwt` form parameter when present
        Returns:
        a TokenResponse populated from the endpoint JSON on HTTP 200; `null` otherwise
      • executeDCR

        public DCRResponse executeDCR​(String ssaJwt)
        Performs Dynamic Client Registration (DCR) using the provided Software Statement Assertion (SSA).
        Parameters:
        ssaJwt - the SSA JWT issued by the Scan server
        Returns:
        a DCRResponse containing the registered client's ID, secret, issuer (opHost), hardwareId, and scan hostname when registration succeeds; `null` if registration fails
      • introspectToken

        public Optional<Map<String,​Object>> introspectToken​(String accessToken,
                                                                  String introspectionEndpoint)
                                                           throws NoSuchAlgorithmException,
                                                                  KeyManagementException
        Perform token introspection against the given introspection endpoint.
        Parameters:
        accessToken - the access token to be introspected
        introspectionEndpoint - the full URL of the introspection endpoint
        Returns:
        an Optional containing the introspection response as a Map when the server returns HTTP 200, `Optional.empty()` otherwise
        Throws:
        NoSuchAlgorithmException - if a required cryptographic algorithm is unavailable when building the HTTP client
        KeyManagementException - if an error occurs initializing key management for the HTTP client