- symm = Symm.encrypt.obtain();
- hsi = SecurityInfoC.instance(access, HttpURLConnection.class);
- }
-
- public synchronized static final TokenClientFactory instance(Access access) throws APIException, GeneralSecurityException, IOException, CadiException {
- if(instance==null) {
- instance = new TokenClientFactory(access);
- }
- return instance;
- }
-
- /**
- * Pickup Timeout from Properties
- *
- * @param tagOrURL
- * @return
- * @throws CadiException
- * @throws LocatorException
- * @throws APIException
- */
- public<INTR> TokenClient newClient(final String tagOrURL) throws CadiException, LocatorException, APIException {
- return newClient(tagOrURL,Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)));
- }
-
- public<INTR> TokenClient newClient(final String tagOrURL, final int timeout) throws CadiException, LocatorException, APIException {
- AAFConHttp ach;
- if(tagOrURL==null) {
- throw new CadiException("parameter tagOrURL cannot be null.");
- } else {
- ach = aafcons.get(tagOrURL);
- if(ach==null) {
- aafcons.put(tagOrURL, ach=new AAFConHttp(access,tagOrURL));
- }
- }
- char okind;
- if( Config.AAF_OAUTH2_TOKEN_URL.equals(tagOrURL) ||
- Config.AAF_OAUTH2_INTROSPECT_URL.equals(tagOrURL) ||
- tagOrURL.equals(access.getProperty(Config.AAF_OAUTH2_TOKEN_URL, null)) ||
- tagOrURL.equals(access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL, null))
- ) {
- okind = Kind.AAF_OAUTH;
- } else {
- okind = Kind.OAUTH;
- }
- TokenClient tci = new TokenClient(
- okind,
- this,
- ach,
- timeout,
- AUTHN_METHOD.none);
- tci.client_creds(access);
- return tci;
- }
-
- public TzClient newTzClient(final String locatorURL) throws CadiException, LocatorException {
- try {
- return new TzHClient(access,hsi,bestLocator(locatorURL));
- } catch (URISyntaxException e) {
- throw new LocatorException(e);
- }
- }
+ symm = Symm.encrypt.obtain();
+ hsi = SecurityInfoC.instance(access, HttpURLConnection.class);
+ }
+
+ public synchronized static final TokenClientFactory instance(Access access) throws APIException, GeneralSecurityException, IOException, CadiException {
+ if (instance==null) {
+ instance = new TokenClientFactory(access);
+ }
+ return instance;
+ }
+
+ /**
+ * Pickup Timeout from Properties
+ *
+ * @param tagOrURL
+ * @return
+ * @throws CadiException
+ * @throws LocatorException
+ * @throws APIException
+ */
+ public<INTR> TokenClient newClient(final String tagOrURL) throws CadiException, LocatorException, APIException {
+ return newClient(tagOrURL,Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)));
+ }
+
+ public<INTR> TokenClient newClient(final String tagOrURL, final int timeout) throws CadiException, LocatorException, APIException {
+ AAFConHttp ach;
+ if (tagOrURL==null) {
+ throw new CadiException("parameter tagOrURL cannot be null.");
+ } else {
+ ach = aafcons.get(tagOrURL);
+ if (ach==null) {
+ aafcons.put(tagOrURL, ach=new AAFConHttp(access,tagOrURL));
+ }
+ }
+ char okind;
+ if ( Config.AAF_OAUTH2_TOKEN_URL.equals(tagOrURL) ||
+ Config.AAF_OAUTH2_INTROSPECT_URL.equals(tagOrURL) ||
+ tagOrURL.equals(access.getProperty(Config.AAF_OAUTH2_TOKEN_URL, null)) ||
+ tagOrURL.equals(access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL, null))
+ ) {
+ okind = Kind.AAF_OAUTH;
+ } else {
+ okind = Kind.OAUTH;
+ }
+ TokenClient tci = new TokenClient(
+ okind,
+ this,
+ ach,
+ timeout,
+ AUTHN_METHOD.none);
+ tci.client_creds(access);
+ return tci;
+ }
+
+ public TzClient newTzClient(final String locatorURL) throws CadiException, LocatorException {
+ try {
+ return new TzHClient(access,hsi,bestLocator(locatorURL));
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
+ }