Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Requesting Party Token (RPT) by API in Keycloak?

I am to struggling to find it but I can't find a solution. Does anyone help me?

Here is my try. #1 First find PAT (Protection API Token) enter image description here

#2 get the permission ticket list enter image description here

#3 try get RPT but got "Ticket verification failed" error. enter image description here

#4 This source code for this error but I am not familiar with the source.

    private PermissionTicketToken verifyPermissionTicket(KeycloakAuthorizationRequest request) {
        String ticketString = request.getTicket();

        PermissionTicketToken ticket = request.getKeycloakSession().tokens().decode(ticketString, PermissionTicketToken.class);
        if (ticket == null) {
            throw new CorsErrorResponseException(request.getCors(), "invalid_ticket", "Ticket verification failed", Status.FORBIDDEN);
        }

It copy from source file(AuthorizationTokenService.java) on line 670. enter image description here

https://www.keycloak.org/docs/latest/authorization_services/#_service_overview

like image 888
Bench Vue Avatar asked Oct 20 '25 04:10

Bench Vue


2 Answers

I spent a lot of time trying to get the RPT and i finally found a solution.

So first you have to get a normal token with the grant_type password :

enter image description here

Then you ask for the party token with the access_token you received, this time your grant_type will be "urn:ietf:params:oauth:grant-type:uma-ticket"

enter image description here

NOTE: here the audience property is the client_id

like image 85
segito10 Avatar answered Oct 22 '25 03:10

segito10


That's quite an advanced / emerging standard you are looking at. User Managed Access is related to User A granting resource access to other users based on verifiable preconditions.

Is that really what you are trying to do? If you can explain your scenario / requirements - eg what components there are - we may be able to suggest a simpler / alternative solution .

like image 34
Gary Archer Avatar answered Oct 22 '25 03:10

Gary Archer