private static Client client(BeanFactory beanFactory) { try { Client client = beanFactory.getBean(Client.class); return new LazyClient(beanFactory, client); } catch (BeansException ex) { return TracingFeignClient.create(beanFactory.getBean(HttpTracing.class), new Client.Default(null, null)); } }
Client dependencyBasedFeignClient() { return new LoadBalancerFeignClient( new Client.Default(null, null), this.loadBalancerFactory, this.springClientFactory) {
/** * Create and return Scope Registration service stubs * * @return ScopeRegistration implementation * @throws APIManagementException if error occurs while crating {@link ScopeRegistration} */ public static ScopeRegistration getScopeRegistration() throws APIManagementException { KeyMgtConfigurations keyManagerConfigs = ServiceReferenceHolder.getInstance().getAPIMConfiguration() .getKeyManagerConfigs(); if (WSO2ISKeyManagerImpl.class.getCanonicalName().equals(keyManagerConfigs.getKeyManagerImplClass())) { WSO2ISScopeRegistrationServiceStub wso2ISScopeRegistrationServiceStub = Feign.builder().requestInterceptor (new BasicAuthRequestInterceptor(keyManagerConfigs.getKeyManagerCredentials().getUsername(), keyManagerConfigs.getKeyManagerCredentials().getPassword())).encoder(new GsonEncoder()) .decoder(new GsonDecoder()).client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory (keyManagerConfigs.getKeyManagerCertAlias()), (hostname, sslSession) -> true)).target (WSO2ISScopeRegistrationServiceStub.class, keyManagerConfigs.getDcrEndpoint()); return new WSO2ISScopeRegistrationImpl(wso2ISScopeRegistrationServiceStub); } else { DefaultScopeRegistrationServiceStub defaultScopeRegistrationServiceStub = Feign.builder().requestInterceptor (new BasicAuthRequestInterceptor(keyManagerConfigs.getKeyManagerCredentials().getUsername(), keyManagerConfigs.getKeyManagerCredentials().getPassword())).encoder(new GsonEncoder()) .decoder(new GsonDecoder()).client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory (keyManagerConfigs.getKeyManagerCertAlias()), (hostname, sslSession) -> true)).target (DefaultScopeRegistrationServiceStub.class, keyManagerConfigs.getDcrEndpoint()); return new DefaultScopeRegistrationImpl(defaultScopeRegistrationServiceStub); } } }
client = new feign.Client.Default(null, null);
/** * Create and return Scope Registration service stubs * * @return ScopeRegistration implementation * @throws APIManagementException if error occurs while crating {@link ScopeRegistration} */ public static ScopeRegistration getScopeRegistration() throws APIManagementException { KeyMgtConfigurations keyManagerConfigs = ServiceReferenceHolder.getInstance().getAPIMConfiguration() .getKeyManagerConfigs(); if (WSO2ISKeyManagerImpl.class.getCanonicalName().equals(keyManagerConfigs.getKeyManagerImplClass())) { WSO2ISScopeRegistrationServiceStub wso2ISScopeRegistrationServiceStub = Feign.builder().requestInterceptor (new BasicAuthRequestInterceptor(keyManagerConfigs.getKeyManagerCredentials().getUsername(), keyManagerConfigs.getKeyManagerCredentials().getPassword())).encoder(new GsonEncoder()) .decoder(new GsonDecoder()).client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory (keyManagerConfigs.getKeyManagerCertAlias()), (hostname, sslSession) -> true)).target (WSO2ISScopeRegistrationServiceStub.class, keyManagerConfigs.getDcrEndpoint()); return new WSO2ISScopeRegistrationImpl(wso2ISScopeRegistrationServiceStub); } else { DefaultScopeRegistrationServiceStub defaultScopeRegistrationServiceStub = Feign.builder().requestInterceptor (new BasicAuthRequestInterceptor(keyManagerConfigs.getKeyManagerCredentials().getUsername(), keyManagerConfigs.getKeyManagerCredentials().getPassword())).encoder(new GsonEncoder()) .decoder(new GsonDecoder()).client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory (keyManagerConfigs.getKeyManagerCertAlias()), (hostname, sslSession) -> true)).target (DefaultScopeRegistrationServiceStub.class, keyManagerConfigs.getDcrEndpoint()); return new DefaultScopeRegistrationImpl(defaultScopeRegistrationServiceStub); } } }
/** * Create and return SCIM service stubs * * @param idpBaseUrl Base URL of Identity Provider Server * @param username Username of IDP * @param password Password of IDP * @param idpCertAlias Alias of Public Key of IDP * @return SCIM Service client * @throws APIManagementException if error occurs while crating SCIM service stub */ public static SCIMServiceStub getSCIMServiceStub(String idpBaseUrl, String username, String password, String idpCertAlias) throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(idpCertAlias), (hostname, sslSession) -> true)) .target(SCIMServiceStub.class, idpBaseUrl + WSO2_SCIM_BASE_PATH); }
/** * Create and return DCR(M) service stubs * * @param dcrEndpoint DCR(M) Endpoint * @param username Username of Key Manager * @param password Password of Key Manager * @param kmCertAlias Alias of Public Key of Key Manager * @return DCR(M) service stubs * @throws APIManagementException if error occurs while crating DCR(M) service stub */ public static DCRMServiceStub getDCRMServiceStub(String dcrEndpoint, String username, String password, String kmCertAlias) throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(DCRMServiceStub.class, dcrEndpoint); }
/** * Create and return DCR(M) service stubs * * @param dcrEndpoint DCR(M) Endpoint * @param username Username of Key Manager * @param password Password of Key Manager * @param kmCertAlias Alias of Public Key of Key Manager * @return DCR(M) service stubs * @throws APIManagementException if error occurs while crating DCR(M) service stub */ public static DCRMServiceStub getDCRMServiceStub(String dcrEndpoint, String username, String password, String kmCertAlias) throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(DCRMServiceStub.class, dcrEndpoint); }
/** * Create and return OAuth2 Introspection service stubs * * @return OAuth2 introspection service stub * @throws APIManagementException if error occurs while crating OAuth2 introspection service stub */ public OAuth2ServiceStubs.IntrospectionServiceStub getIntrospectionServiceStub() throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.IntrospectionServiceStub.class, introspectEndpoint); } /**
/** * Create and return OAuth2 Introspection service stubs * * @return OAuth2 introspection service stub * @throws APIManagementException if error occurs while crating OAuth2 introspection service stub */ public OAuth2ServiceStubs.IntrospectionServiceStub getIntrospectionServiceStub() throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.IntrospectionServiceStub.class, introspectEndpoint); } /**
/** * Create and return SCIM service stubs * * @param idpBaseUrl Base URL of Identity Provider Server * @param username Username of IDP * @param password Password of IDP * @param idpCertAlias Alias of Public Key of IDP * @return SCIM Service client * @throws APIManagementException if error occurs while crating SCIM service stub */ public static SCIMServiceStub getSCIMServiceStub(String idpBaseUrl, String username, String password, String idpCertAlias) throws APIManagementException { return Feign.builder() .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(idpCertAlias), (hostname, sslSession) -> true)) .target(SCIMServiceStub.class, idpBaseUrl + WSO2_SCIM_BASE_PATH); }
/** * Create and return OAuth2 token service stubs * * @return OAuth2 token service stub * @throws APIManagementException if error occurs while crating OAuth2 token service stub */ public OAuth2ServiceStubs.TokenServiceStub getTokenServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.TokenServiceStub.class, tokenEndpoint); }
/** * Create and return OAuth2 UserInfo service stubs * * @return OAuth2 introspection service stub * @throws APIManagementException if error occurs while crating OAuth2 introspection service stub */ public OAuth2ServiceStubs.UserInfoServiceStub getUserInfoServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.UserInfoServiceStub.class, userInfoEndpoint); }
/** * Create and return OAuth2 token service stubs * * @return OAuth2 token service stub * @throws APIManagementException if error occurs while crating OAuth2 token service stub */ public OAuth2ServiceStubs.TokenServiceStub getTokenServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.TokenServiceStub.class, tokenEndpoint); }
/** * Create and return OAuth2 UserInfo service stubs * * @return OAuth2 introspection service stub * @throws APIManagementException if error occurs while crating OAuth2 introspection service stub */ public OAuth2ServiceStubs.UserInfoServiceStub getUserInfoServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .decoder(new GsonDecoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.UserInfoServiceStub.class, userInfoEndpoint); }
public Client newDefaultClientInstance() { if (!isHostnameVerifierEnabled) { return new Client.Default(null, (hostName, sslSession) -> true); } else { return new Client.Default(null, null); } }
private static Client client(BeanFactory beanFactory) { try { Client client = beanFactory.getBean(Client.class); return new LazyClient(beanFactory, client); } catch (BeansException ex) { return TracingFeignClient.create(beanFactory.getBean(HttpTracing.class), new Client.Default(null, null)); } }
private static Client client(BeanFactory beanFactory) { try { Client client = beanFactory.getBean(Client.class); return new LazyClient(beanFactory, client); } catch (BeansException ex) { return TracingFeignClient.create(beanFactory.getBean(HttpTracing.class), new Client.Default(null, null)); } }
/** * Create and return OAuth2 revoke service stubs * * @return OAuth2 revoke service stub * @throws APIManagementException if error occurs while crating OAuth2 revoke service stub */ public OAuth2ServiceStubs.RevokeServiceStub getRevokeServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.RevokeServiceStub.class, revokeEndpoint); }
/** * Create and return OAuth2 revoke service stubs * * @return OAuth2 revoke service stub * @throws APIManagementException if error occurs while crating OAuth2 revoke service stub */ public OAuth2ServiceStubs.RevokeServiceStub getRevokeServiceStub() throws APIManagementException { return Feign.builder() .encoder(new FormEncoder()) .client(new Client.Default(AMSSLSocketFactory.getSSLSocketFactory(kmCertAlias), (hostname, sslSession) -> true)) .target(OAuth2ServiceStubs.RevokeServiceStub.class, revokeEndpoint); }