cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Auth Profiles list from Auth Manager

SOLVED
New Contributor

How to get Auth Profiles list from Auth Manager

Greetings,

 

How it's possible to get the list of Auth Profiles in Auth Manager in SoapUI Pro via groovy script using SoapUI Apis?

I need to read every associated token to each profile.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super Contributor

Re: How to get Auth Profiles list from Auth Manager

I've had a little bit of experience with looking at the auth repository via Groovy, though not not with OAuth profiles or specifically what you are after, hopefully this will get you started:

 

def authRepository = testRunner.getTestCase().getProject().getAuthRepository()
def entrylist = authRepository.getEntryList()

entrylist.each(){ entry -> 
	log.info('Entry "' + entry.getName() + '" class = ' + entry.getClass())
}

When you find out what class the entry is you can look it up in the API Docs to see how to access the data you need.

 

I think that the OAuth 2 profile entries have a method getAccessToken() which may provide the data you need.

 

 

 

 

3 REPLIES 3
Highlighted
Super Contributor

Re: How to get Auth Profiles list from Auth Manager

I've had a little bit of experience with looking at the auth repository via Groovy, though not not with OAuth profiles or specifically what you are after, hopefully this will get you started:

 

def authRepository = testRunner.getTestCase().getProject().getAuthRepository()
def entrylist = authRepository.getEntryList()

entrylist.each(){ entry -> 
	log.info('Entry "' + entry.getName() + '" class = ' + entry.getClass())
}

When you find out what class the entry is you can look it up in the API Docs to see how to access the data you need.

 

I think that the OAuth 2 profile entries have a method getAccessToken() which may provide the data you need.

 

 

 

 

Community Hero

Re: How to get Auth Profiles list from Auth Manager

Hope you know to get the teststep object.

Then try and see if that helps:
log.info teststep.authProfile

 

Or see if "AuthProfileHolderContainer" is the one you want?



Regards,
Rao.
New Contributor

Re: How to get Auth Profiles list from Auth Manager

Thanks @Radford, it was really fast and useful. 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors