lib/fusionauth/fusionauth_client.rb in fusionauth_client-1.19.0 vs lib/fusionauth/fusionauth_client.rb in fusionauth_client-1.20.0

- old
+ new

@@ -938,12 +938,12 @@ # application such as Google Authenticator. # # @param encoded_jwt [string] The encoded JWT (access token). # @return [FusionAuth::ClientResponse] The ClientResponse object. def generate_two_factor_secret_using_jwt(encoded_jwt) - start.uri('/api/two-factor/secret') - .authorization('JWT ' + encoded_jwt) + startAnonymous.uri('/api/two-factor/secret') + .authorization('Bearer ' + encoded_jwt) .get() .go() end # @@ -1011,10 +1011,27 @@ .post() .go() end # + # Inspect an access token issued by FusionAuth. + # + # @param client_id [string] The unique client identifier. The client Id is the Id of the FusionAuth Application for which this token was generated. + # @param token [string] The access token returned by this OAuth provider as the result of a successful authentication. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def introspect_access_token(client_id, token) + body = { + "client_id" => client_id, + "token" => token + } + startAnonymous.uri('/oauth2/introspect') + .body_handler(FusionAuth::FormDataBodyHandler.new(body)) + .post() + .go() + end + + # # Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid # access token is properly signed and not expired. # <p> # This API may be used in an SSO configuration to issue new tokens for another application after the user has # obtained a valid token from authentication. @@ -1024,12 +1041,12 @@ # @param refresh_token [string] (Optional) An existing refresh token used to request a refresh token in addition to a JWT in the response. # <p>The target application represented by the applicationId request parameter must have refresh # tokens enabled in order to receive a refresh token in the response.</p> # @return [FusionAuth::ClientResponse] The ClientResponse object. def issue_jwt(application_id, encoded_jwt, refresh_token) - start.uri('/api/jwt/issue') - .authorization('JWT ' + encoded_jwt) + startAnonymous.uri('/api/jwt/issue') + .authorization('Bearer ' + encoded_jwt) .url_parameter('applicationId', application_id) .url_parameter('refreshToken', refresh_token) .get() .go() end @@ -2326,10 +2343,22 @@ .get() .go() end # + # Call the UserInfo endpoint to retrieve User Claims from the access token issued by FusionAuth. + # + # @param encoded_jwt [string] The encoded JWT (access token). + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def retrieve_user_info_from_access_token(encoded_jwt) + startAnonymous.uri('/oauth2/userinfo') + .authorization('Bearer ' + encoded_jwt) + .get() + .go() + end + + # # Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the # login counts for that application. # # @param application_id [string] (Optional) The application id. # @param user_id [string] The userId id. @@ -2386,11 +2415,11 @@ # # @param encoded_jwt [string] The encoded JWT (access token). # @return [FusionAuth::ClientResponse] The ClientResponse object. def retrieve_user_using_jwt(encoded_jwt) startAnonymous.uri('/api/user') - .authorization('JWT ' + encoded_jwt) + .authorization('Bearer ' + encoded_jwt) .get() .go() end # @@ -2949,10 +2978,10 @@ # # @param encoded_jwt [string] The encoded JWT (access token). # @return [FusionAuth::ClientResponse] The ClientResponse object. def validate_jwt(encoded_jwt) startAnonymous.uri('/api/jwt/validate') - .authorization('JWT ' + encoded_jwt) + .authorization('Bearer ' + encoded_jwt) .get() .go() end #