cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
718
Views
0
Helpful
1
Replies

Admin API Token Question

ROHIT_Pawar
Level 1
Level 1
  • [/admin/v1/users/[user_id]/tokens ] hello i have to check that the token is malicious or not .

so i am thinking to use this [/admin/v1/users/[user_id]/tokens ] and get token again and compare and validate it is right thing i am doing or anyother way exists /or what i am doing is needed or not (for malicious token it is checking internally )
my code :-

        String newState = request.getParameter("state");
        //if newState(coming from server) is not in the stateMap then that means session is expired ("message", "Session Expired")so return error.
        if (!stateMap.containsKey(newState)) {
            Debug.log("state is expired so go for DuoAuth again",Module);
            return "error";
        }
        String username = stateMap.remove(newState);
        //Exchange the auth duoCode for a Token object
        Token token = null;
        try {
            token = duoClient.exchangeAuthorizationCodeFor2FAResult(duoCode, username);
        } catch (DuoException e) {
            Debug.logError(e, Module);
            return "error";
        }
        Debug.logInfo ("generated token" + token, Module);
        // If the auth was successful, render the welcome page otherwise return an error
        if (DuoUtilHelper.authWasSuccessful(token)) {
            storedToken = token;
            return "success";
        } else {
            return "error";
        }```
i have a token received from exchangeAuthorizationCodeFor2FAResult(duoCode, username) i have to check that it is an valid token or it is malicious  token
1 Reply 1

TabBerger
Cisco Employee
Cisco Employee

Hi there @ROHIT_Pawar ! I noticed your question on one of our old Release Notes threads. I’ve moved the post over to the API forum so it doesn’t get missed Cheers! -Tab

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links