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; }
/** * @param subject * @return the possibly modified subject */ public Subject getSubject(Subject subject) { AuthMethod am = AuthenticationUtil.getAuthMethod(subject); if (am == null || AuthMethod.ANON.equals(am)) { return subject; } if (subject != null && subject.getPrincipals().size() > 0) { Profiler prof = new Profiler(AuthenticatorImpl.class); this.augmentSubject(subject); prof.checkpoint("AuthenticatorImpl.augmentSubject()"); } return subject; }
/** * 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; }
if (am != null && !AuthMethod.ANON.equals(am)) {
if (am == null || AuthMethod.ANON.equals(am)) return false;
private void writeJobListing() throws IOException, JobPersistenceException, TransientException { Subject caller = AuthenticationUtil.getCurrentSubject(); AuthMethod am = AuthenticationUtil.getAuthMethod(caller); if (am == null || AuthMethod.ANON.equals(am)) { throw new AccessControlException("anonymous job listing not permitted");