private void configureAuthAndBuildClient ( ClientBuilder clientBuilder , List < Stage . ConfigIssue > issues ) { if ( jerseyClientConfig . authType == AuthenticationType . OAUTH ) { String consumerKey = jerseyClientConfig . oauth . resolveConsumerKey ( context , "CREDENTIALS" , "conf.oauth." , issues ) ; String consumerSecret = jerseyClientConfig . oauth . resolveConsumerSecret ( context , "CREDENTIALS" , "conf.oauth." , issues ) ; String token = jerseyClientConfig . oauth . resolveToken ( context , "CREDENTIALS" , "conf.oauth." , issues ) ; String tokenSecret = jerseyClientConfig . oauth . resolveTokenSecret ( context , "CREDENTIALS" , "conf.oauth." , issues ) ; if ( issues . isEmpty ( ) ) { authToken = JerseyClientUtil . configureOAuth1 ( consumerKey , consumerSecret , token , tokenSecret , clientBuilder ) ; } } else if ( jerseyClientConfig . authType . isOneOf ( AuthenticationType . DIGEST , AuthenticationType . BASIC , AuthenticationType . UNIVERSAL ) ) { String username = jerseyClientConfig . basicAuth . resolveUsername ( context , "CREDENTIALS" , "conf.basicAuth." , issues ) ; String password = jerseyClientConfig . basicAuth . resolvePassword ( context , "CREDENTIALS" , "conf.basicAuth." , issues ) ; if ( issues . isEmpty ( ) ) { JerseyClientUtil . configurePasswordAuth ( jerseyClientConfig . authType , username , password , clientBuilder ) ; } } try { buildNewAuthenticatedClient ( issues , false ) ; clientInitialized = true ; } catch ( StageException e ) { // should not happen, since we passed throwExceptions as false above ExceptionUtils . throwUndeclared ( e ) ; } }
Helper to apply authentication properties to Jersey client .