private URL getJobListURL() { AuthMethod am = AuthMethod.ANON; if (subject != null) { am = AuthenticationUtil.getAuthMethodFromCredentials(subject); } RegistryClient rc = new RegistryClient(); URL ret = rc.getServiceURL(resourceID, standardID, am, interfaceType); if (ret == null) { throw new RuntimeException("init FAIL, service not found:" + resourceID + " " + standardID + " " + am + " " + interfaceType); } log.info("jobListURL: " + ret); return ret; }
private URL lookupServiceURL(final URI standard) throws AccessControlException { Subject subject = AuthenticationUtil.getCurrentSubject(); AuthMethod am = AuthenticationUtil.getAuthMethodFromCredentials(subject); URL serviceURL = getRegistryClient().getServiceURL(this.serviceID, standard, am); if (serviceURL == null) { throw new RuntimeException( String.format("Unable to get Service URL for '%s', '%s', '%s'", serviceID.toString(), standard, am)); } return serviceURL; }
private AuthMethod getAuthMethod() throws AccessControlException { Subject subject = AuthenticationUtil.getCurrentSubject(); AuthMethod am = AuthenticationUtil.getAuthMethodFromCredentials(subject); if (am == null || am.equals(AuthMethod.ANON)) { throw new AccessControlException("Anonymous access not supported."); } return am; }
@Override public URL toURL(URI uri) { if (!SCHEME.equals(uri.getScheme())) { throw new IllegalArgumentException("invalid scheme in " + uri); } try { Subject subject = AuthenticationUtil.getCurrentSubject(); AuthMethod authMethod = AuthenticationUtil.getAuthMethodFromCredentials(subject); if (authMethod == null) { authMethod = AuthMethod.ANON; } RegistryClient rc = new RegistryClient(); Capabilities caps = rc.getCapabilities(DATA_RESOURCE_ID); Capability dataCap = caps.findCapability(Standards.DATA_10); Interface ifc = dataCap.findInterface(authMethod); if (ifc == null) { throw new IllegalArgumentException("No interface for auth method " + authMethod); } String baseDataURL = ifc.getAccessURL().getURL().toString(); URL url = new URL(baseDataURL + "/MAST/" + uri.getSchemeSpecificPart()); log.debug(uri + " --> " + url); return url; } catch (MalformedURLException ex) { throw new RuntimeException("BUG", ex); } catch (Throwable t) { String message = "Failed to convert to data URL"; throw new RuntimeException(message, t); } }
/** * Lookup the Service URL for the given standard. The current AuthMethod * will be taken into account. * * @param standard The URI standard to look up. * @return URL for the service. * @throws AccessControlException If the URL cannot be found for the * provided AuthMethod. */ private URL lookupServiceURL(final URI standard) throws AccessControlException { Subject subject = AuthenticationUtil.getCurrentSubject(); AuthMethod am = AuthenticationUtil.getAuthMethodFromCredentials(subject); if (am == null || am.equals(AuthMethod.ANON)) { throw new AccessControlException("Anonymous access not supported."); } URL serviceURL = getRegistryClient().getServiceURL(this.serviceID, standard, am); if (serviceURL == null) { throw new RuntimeException( String.format("Unable to get Service URL for '%s', '%s', '%s'", serviceID.toString(), standard, am)); } return serviceURL; }
AuthMethod meth = AuthenticationUtil.getAuthMethodFromCredentials(subject); log.info("authentication using: " + meth);
protocols.add(new Protocol(VOS.PROTOCOL_HTTP_PUT)); if (AuthenticationUtil.getAuthMethodFromCredentials(AuthenticationUtil.getCurrentSubject()) == AuthMethod.CERT)