/*L * Copyright Washington University in St.Louis * Copyright Information Management Services, Inc. * Copyright Sapient * Copyright Booz Allen Hamilton * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/common-biorepository-model/LICENSE.txt for details. */ package org.cagrid.CBM.service.globus; import java.rmi.RemoteException; import java.util.HashMap; import java.util.Map; import java.io.File; import javax.security.auth.Subject; import javax.xml.namespace.QName; import javax.xml.rpc.handler.MessageContext; import gov.nih.nci.cagrid.introduce.servicetools.security.AuthorizationExtension; import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException; import org.globus.wsrf.impl.security.authorization.exceptions.CloseException; import org.globus.wsrf.impl.security.authorization.exceptions.InitializeException; import org.globus.wsrf.impl.security.authorization.exceptions.InvalidPolicyException; import org.globus.wsrf.security.authorization.PDP; import org.globus.wsrf.security.authorization.PDPConfig; import org.globus.wsrf.config.ContainerConfig; import org.w3c.dom.Node; /** * DO NOT EDIT: This class is autogenerated! * * This is a PDP for use with the globus authorization callout. * This class will have a authorize method for each method on this grid service. * The method is responsible for making any authorization callouts required to satisfy the * authorization requirements placed on each method call. Each method will either return * upon a successful authorization or will throw an exception upon a failed authorization. * * @created by Introduce Toolkit version 1.4 * */ public class CBMAuthorization implements PDP { public static final String SERVICE_NAMESPACE = "http://CBM.cagrid.org/CBM"; Map authorizationClassMap = new HashMap(); public CBMAuthorization() { } protected String getServiceNamespace(){ return SERVICE_NAMESPACE; } public static String getCallerIdentity() { String caller = org.globus.wsrf.security.SecurityManager.getManager().getCaller(); if ((caller == null) || (caller.equals("<anonymous>"))) { return null; } else { return caller; } } public void authorizeGetMultipleResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeGetResourceProperty(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeQueryResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeGetServiceSecurityMetadata(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeExecuteQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeTransferQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeExecuteTransferQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public void authorizeExtractCBMdata(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { } public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("query")){ authorizeQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("executeQuery")){ authorizeExecuteQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("transferQuery")){ authorizeTransferQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("executeTransferQuery")){ authorizeExecuteTransferQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("extractCBMdata")){ authorizeExtractCBMdata(peerSubject, context, operation); return true; } return false; } public Node getPolicy(Node query) throws InvalidPolicyException { return null; } public String[] getPolicyNames() { return null; } public Node setPolicy(Node policy) throws InvalidPolicyException { return null; } public void close() throws CloseException { } public void initialize(PDPConfig config, String name, String id) throws InitializeException { try{ String serviceName = (String)config.getProperty(name, "serviceName"); String etcPath = ContainerConfig.getBaseDirectory() + File.separator + (String)config.getProperty(name, "etcDirectoryPath"); } catch (Exception e){ throw new InitializeException(e.getMessage(),e); } } }