Class BaseService

    • 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)
        Request an access token from the token endpoint using the provided TokenRequest. Builds a form using fields from tokenRequest (code, scope, code_verifier, grant_type, redirect_uri, client_id) and includes userInfoJwt as the ujwt parameter when present, then POSTs the form to tokenEndpoint using the client credentials in tokenRequest.
        Parameters:
        tokenRequest - contains values used to construct the token request (authorization code, scope, PKCE verifier, grant type, redirect URI, client identifier, and encoded client credentials)
        tokenEndpoint - the URL of the authorization server token endpoint to which the request will be sent
        userInfoJwt - optional JWT to include as the ujwt form parameter when present
        Returns:
        a io.jans.as.client.TokenResponse populated from the server 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