private V1Connector versionOneAuthentication ( Map < String , String > auth ) throws HygieiaException { V1Connector connector ; try { if ( ! StringUtils . isEmpty ( auth . get ( "v1ProxyUrl" ) ) ) { ProxyProvider proxyProvider = new ProxyProvider ( new URI ( auth . get ( "v1ProxyUrl" ) ) , "" , "" ) ; connector = V1Connector . withInstanceUrl ( auth . get ( "v1BaseUri" ) ) . withUserAgentHeader ( FeatureCollectorConstants . AGENT_NAME , FeatureCollectorConstants . AGENT_VER ) . withAccessToken ( auth . get ( "v1AccessToken" ) ) . withProxy ( proxyProvider ) . build ( ) ; } else { connector = V1Connector . withInstanceUrl ( auth . get ( "v1BaseUri" ) ) . withUserAgentHeader ( FeatureCollectorConstants . AGENT_NAME , FeatureCollectorConstants . AGENT_VER ) . withAccessToken ( auth . get ( "v1AccessToken" ) ) . build ( ) ; } } catch ( V1Exception ve ) { throw new HygieiaException ( "FAILED: VersionOne was not able to authenticate" , ve , HygieiaException . INVALID_CONFIGURATION ) ; } catch ( MalformedURLException | URISyntaxException me ) { throw new HygieiaException ( "FAILED: Invalid VersionOne URL." , me , HygieiaException . INVALID_CONFIGURATION ) ; } return connector ; }
Used for establishing connection to VersionOne based on authentication