Rajitha Kumara 4 weeks ago
parent 934de80796
commit 18d8261f4e

@ -29,10 +29,11 @@ public interface IOAuthClientService {
/** /**
* Handle execution of a APIM REST services invocation request. Token and cache handling will be handled by the * Handle execution of a APIM REST services invocation request. Token and cache handling will be handled by the
* service itself. * service itself.
*
* @param request Instance of {@link Request} to execute * @param request Instance of {@link Request} to execute
* @return Instance of {@link OAuthClientResponse} when successful invocation happens * @return Instance of {@link OAuthClientResponse} when successful invocation happens
* @throws OAuthClientException {@link OAuthClientException} * @throws OAuthClientException {@link OAuthClientException}
* @throws BadRequestException {@link BadRequestException} * @throws BadRequestException {@link BadRequestException}
* @throws UnexpectedResponseException {@link UnexpectedResponseException} * @throws UnexpectedResponseException {@link UnexpectedResponseException}
*/ */
OAuthClientResponse execute(Request request) throws OAuthClientException, BadRequestException, OAuthClientResponse execute(Request request) throws OAuthClientException, BadRequestException,

@ -73,10 +73,11 @@ public class OAuthClient implements IOAuthClientService {
/** /**
* Handle execution of a APIM REST services invocation request. Token and cache handling will be handled by the * Handle execution of a APIM REST services invocation request. Token and cache handling will be handled by the
* service itself. * service itself.
*
* @param request Instance of {@link Request} to execute * @param request Instance of {@link Request} to execute
* @return Instance of {@link OAuthClientResponse} when successful invocation happens * @return Instance of {@link OAuthClientResponse} when successful invocation happens
* @throws OAuthClientException {@link OAuthClientException} * @throws OAuthClientException {@link OAuthClientException}
* @throws BadRequestException {@link BadRequestException} * @throws BadRequestException {@link BadRequestException}
* @throws UnexpectedResponseException {@link UnexpectedResponseException} * @throws UnexpectedResponseException {@link UnexpectedResponseException}
*/ */
@Override @Override
@ -230,11 +231,12 @@ public class OAuthClient implements IOAuthClientService {
/** /**
* Obtain and refresh idn auth tokens. Note that in the first try it try to obtain new tokens via refresh_token * Obtain and refresh idn auth tokens. Note that in the first try it try to obtain new tokens via refresh_token
* grant type, if it fails it tries to obtain new tokens via password grant type. * grant type, if it fails it tries to obtain new tokens via password grant type.
* @param keys Instance of {@link Keys} containing the dcr client's credentials *
* @param keys Instance of {@link Keys} containing the dcr client's credentials
* @param refreshToken Refresh token * @param refreshToken Refresh token
* @return Instance of {@link Tokens} containing the tokens * @return Instance of {@link Tokens} containing the tokens
* @throws UserStoreException Throws when error encountered while obtaining user realm service * @throws UserStoreException Throws when error encountered while obtaining user realm service
* @throws IOException Throws when error encountered while executing token request * @throws IOException Throws when error encountered while executing token request
* @throws OAuthClientException Throws when failed to obtain tokens * @throws OAuthClientException Throws when failed to obtain tokens
*/ */
private Tokens idnTokenRefresh(Keys keys, String refreshToken) throws UserStoreException, IOException, private Tokens idnTokenRefresh(Keys keys, String refreshToken) throws UserStoreException, IOException,
@ -264,6 +266,7 @@ public class OAuthClient implements IOAuthClientService {
/** /**
* Intercept the request and add authorization header base on available tokens. * Intercept the request and add authorization header base on available tokens.
*
* @param request Instance of the {@link Request} to intercept * @param request Instance of the {@link Request} to intercept
* @return Intercepted request * @return Intercepted request
* @throws OAuthClientException Throws when error encountered while adding authorization header * @throws OAuthClientException Throws when error encountered while adding authorization header
@ -292,6 +295,7 @@ public class OAuthClient implements IOAuthClientService {
/** /**
* Refresh cached tokens. * Refresh cached tokens.
*
* @throws OAuthClientException Throws when error encountered while refreshing the tokens * @throws OAuthClientException Throws when error encountered while refreshing the tokens
*/ */
private void refresh() throws OAuthClientException { private void refresh() throws OAuthClientException {

Loading…
Cancel
Save