adding Authz Token to getAPIVersion method
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c139ecef Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c139ecef Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c139ecef Branch: refs/heads/master Commit: c139ecefb4a047931c4edb38ce8cd7a3a08a04a2 Parents: 87b72f9 Author: Supun Nakandala <[email protected]> Authored: Sat Sep 5 12:28:59 2015 +0530 Committer: Supun Nakandala <[email protected]> Committed: Sat Sep 5 12:28:59 2015 +0530 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 3 +- .../java/org/apache/airavata/api/Airavata.java | 139 +++++++++++++++++-- .../main/resources/lib/airavata/Airavata.cpp | 35 ++++- .../src/main/resources/lib/airavata/Airavata.h | 32 +++-- .../lib/airavata/Airavata_server.skeleton.cpp | 4 +- .../resources/lib/Airavata/API/Airavata.php | 42 +++++- .../lib/apache/airavata/api/Airavata-remote | 8 +- .../lib/apache/airavata/api/Airavata.py | 39 +++++- .../client/samples/CreateLaunchBES.java | 2 +- .../client/samples/CreateLaunchExperiment.java | 2 +- .../samples/CreateLaunchExperimentUS3.java | 2 +- .../tools/RegisterOGCEUS3Application.java | 2 +- .../tools/RegisterSampleApplications.java | 2 +- .../client/tools/RegisterUS3Application.java | 2 +- .../airavata-api/airavata_api.thrift | 2 +- 15 files changed, 265 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index 2e5f77a..ec39c2e 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -96,7 +96,8 @@ public class AiravataServerHandler implements Airavata.Iface { * Query Airavata to fetch the API version */ @Override - public String getAPIVersion() throws InvalidRequestException, AiravataClientException, + @SecurityCheck + public String getAPIVersion(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { return airavata_apiConstants.AIRAVATA_API_VERSION; http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 640206e..0bd7cfa 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -58,8 +58,10 @@ public class Airavata { /** * Fetch Apache Airavata API version + * + * @param authzToken */ - public String getAPIVersion() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + public String getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; public String addGateway(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.workspace.Gateway gateway) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; @@ -1771,7 +1773,7 @@ public class Airavata { public interface AsyncIface { - public void getAPIVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void addGateway(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.workspace.Gateway gateway, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -2029,15 +2031,16 @@ public class Airavata { super(iprot, oprot); } - public String getAPIVersion() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException + public String getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException { - send_getAPIVersion(); + send_getAPIVersion(authzToken); return recv_getAPIVersion(); } - public void send_getAPIVersion() throws org.apache.thrift.TException + public void send_getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.thrift.TException { getAPIVersion_args args = new getAPIVersion_args(); + args.setAuthzToken(authzToken); sendBase("getAPIVersion", args); } @@ -6384,21 +6387,24 @@ public class Airavata { super(protocolFactory, clientManager, transport); } - public void getAPIVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getAPIVersion_call method_call = new getAPIVersion_call(resultHandler, this, ___protocolFactory, ___transport); + getAPIVersion_call method_call = new getAPIVersion_call(authzToken, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getAPIVersion_call extends org.apache.thrift.async.TAsyncMethodCall { - public getAPIVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private org.apache.airavata.model.security.AuthzToken authzToken; + public getAPIVersion_call(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); + this.authzToken = authzToken; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAPIVersion", org.apache.thrift.protocol.TMessageType.CALL, 0)); getAPIVersion_args args = new getAPIVersion_args(); + args.setAuthzToken(authzToken); args.write(prot); prot.writeMessageEnd(); } @@ -10958,7 +10964,7 @@ public class Airavata { public getAPIVersion_result getResult(I iface, getAPIVersion_args args) throws org.apache.thrift.TException { getAPIVersion_result result = new getAPIVersion_result(); try { - result.success = iface.getAPIVersion(); + result.success = iface.getAPIVersion(args.authzToken); } catch (org.apache.airavata.model.error.InvalidRequestException ire) { result.ire = ire; } catch (org.apache.airavata.model.error.AiravataClientException ace) { @@ -14731,7 +14737,7 @@ public class Airavata { } public void start(I iface, getAPIVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { - iface.getAPIVersion(resultHandler); + iface.getAPIVersion(args.authzToken,resultHandler); } } @@ -23220,6 +23226,7 @@ public class Airavata { public static class getAPIVersion_args implements org.apache.thrift.TBase<getAPIVersion_args, getAPIVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAPIVersion_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAPIVersion_args"); + private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -23227,10 +23234,11 @@ public class Airavata { schemes.put(TupleScheme.class, new getAPIVersion_argsTupleSchemeFactory()); } + public org.apache.airavata.model.security.AuthzToken authzToken; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; + AUTHZ_TOKEN((short)1, "authzToken"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -23245,6 +23253,8 @@ public class Airavata { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { + case 1: // AUTHZ_TOKEN + return AUTHZ_TOKEN; default: return null; } @@ -23283,9 +23293,13 @@ public class Airavata { return _fieldName; } } + + // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.security.AuthzToken.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAPIVersion_args.class, metaDataMap); } @@ -23293,10 +23307,20 @@ public class Airavata { public getAPIVersion_args() { } + public getAPIVersion_args( + org.apache.airavata.model.security.AuthzToken authzToken) + { + this(); + this.authzToken = authzToken; + } + /** * Performs a deep copy on <i>other</i>. */ public getAPIVersion_args(getAPIVersion_args other) { + if (other.isSetAuthzToken()) { + this.authzToken = new org.apache.airavata.model.security.AuthzToken(other.authzToken); + } } public getAPIVersion_args deepCopy() { @@ -23305,15 +23329,51 @@ public class Airavata { @Override public void clear() { + this.authzToken = null; + } + + public org.apache.airavata.model.security.AuthzToken getAuthzToken() { + return this.authzToken; + } + + public getAPIVersion_args setAuthzToken(org.apache.airavata.model.security.AuthzToken authzToken) { + this.authzToken = authzToken; + return this; + } + + public void unsetAuthzToken() { + this.authzToken = null; + } + + /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */ + public boolean isSetAuthzToken() { + return this.authzToken != null; + } + + public void setAuthzTokenIsSet(boolean value) { + if (!value) { + this.authzToken = null; + } } public void setFieldValue(_Fields field, Object value) { switch (field) { + case AUTHZ_TOKEN: + if (value == null) { + unsetAuthzToken(); + } else { + setAuthzToken((org.apache.airavata.model.security.AuthzToken)value); + } + break; + } } public Object getFieldValue(_Fields field) { switch (field) { + case AUTHZ_TOKEN: + return getAuthzToken(); + } throw new IllegalStateException(); } @@ -23325,6 +23385,8 @@ public class Airavata { } switch (field) { + case AUTHZ_TOKEN: + return isSetAuthzToken(); } throw new IllegalStateException(); } @@ -23342,6 +23404,15 @@ public class Airavata { if (that == null) return false; + boolean this_present_authzToken = true && this.isSetAuthzToken(); + boolean that_present_authzToken = true && that.isSetAuthzToken(); + if (this_present_authzToken || that_present_authzToken) { + if (!(this_present_authzToken && that_present_authzToken)) + return false; + if (!this.authzToken.equals(that.authzToken)) + return false; + } + return true; } @@ -23349,6 +23420,11 @@ public class Airavata { public int hashCode() { List<Object> list = new ArrayList<Object>(); + boolean present_authzToken = true && (isSetAuthzToken()); + list.add(present_authzToken); + if (present_authzToken) + list.add(authzToken); + return list.hashCode(); } @@ -23360,6 +23436,16 @@ public class Airavata { int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAuthzToken()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -23380,13 +23466,26 @@ public class Airavata { StringBuilder sb = new StringBuilder("getAPIVersion_args("); boolean first = true; + sb.append("authzToken:"); + if (this.authzToken == null) { + sb.append("null"); + } else { + sb.append(this.authzToken); + } + first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields + if (authzToken == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString()); + } // check for sub-struct validity + if (authzToken != null) { + authzToken.validate(); + } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -23423,6 +23522,15 @@ public class Airavata { break; } switch (schemeField.id) { + case 1: // AUTHZ_TOKEN + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.authzToken = new org.apache.airavata.model.security.AuthzToken(); + struct.authzToken.read(iprot); + struct.setAuthzTokenIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -23438,6 +23546,11 @@ public class Airavata { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.authzToken != null) { + oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC); + struct.authzToken.write(oprot); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -23455,11 +23568,15 @@ public class Airavata { @Override public void write(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; + struct.authzToken.write(oprot); } @Override public void read(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; + struct.authzToken = new org.apache.airavata.model.security.AuthzToken(); + struct.authzToken.read(iprot); + struct.setAuthzTokenIsSet(true); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp index a2f86b2..160b94f 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp @@ -41,6 +41,7 @@ uint32_t Airavata_getAPIVersion_args::read(::apache::thrift::protocol::TProtocol using ::apache::thrift::protocol::TProtocolException; + bool isset_authzToken = false; while (true) { @@ -48,12 +49,27 @@ uint32_t Airavata_getAPIVersion_args::read(::apache::thrift::protocol::TProtocol if (ftype == ::apache::thrift::protocol::T_STOP) { break; } - xfer += iprot->skip(ftype); + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authzToken.read(iprot); + isset_authzToken = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); + if (!isset_authzToken) + throw TProtocolException(TProtocolException::INVALID_DATA); return xfer; } @@ -62,6 +78,10 @@ uint32_t Airavata_getAPIVersion_args::write(::apache::thrift::protocol::TProtoco oprot->incrementRecursionDepth(); xfer += oprot->writeStructBegin("Airavata_getAPIVersion_args"); + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->authzToken.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); oprot->decrementRecursionDepth(); @@ -78,6 +98,10 @@ uint32_t Airavata_getAPIVersion_pargs::write(::apache::thrift::protocol::TProtoc oprot->incrementRecursionDepth(); xfer += oprot->writeStructBegin("Airavata_getAPIVersion_pargs"); + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->authzToken)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); oprot->decrementRecursionDepth(); @@ -36857,18 +36881,19 @@ uint32_t Airavata_isWorkflowExistWithName_presult::read(::apache::thrift::protoc return xfer; } -void AiravataClient::getAPIVersion(std::string& _return) +void AiravataClient::getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { - send_getAPIVersion(); + send_getAPIVersion(authzToken); recv_getAPIVersion(_return); } -void AiravataClient::send_getAPIVersion() +void AiravataClient::send_getAPIVersion(const ::apache::airavata::model::security::AuthzToken& authzToken) { int32_t cseqid = 0; oprot_->writeMessageBegin("getAPIVersion", ::apache::thrift::protocol::T_CALL, cseqid); Airavata_getAPIVersion_pargs args; + args.authzToken = &authzToken; args.write(oprot_); oprot_->writeMessageEnd(); @@ -45348,7 +45373,7 @@ void AiravataProcessor::process_getAPIVersion(int32_t seqid, ::apache::thrift::p Airavata_getAPIVersion_result result; try { - iface_->getAPIVersion(result.success); + iface_->getAPIVersion(result.success, args.authzToken); result.__isset.success = true; } catch ( ::apache::airavata::api::error::InvalidRequestException &ire) { result.ire = ire; http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h index 716618f..a3077d8 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h @@ -35,8 +35,10 @@ class AiravataIf { /** * Fetch Apache Airavata API version + * + * @param authzToken */ - virtual void getAPIVersion(std::string& _return) = 0; + virtual void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) = 0; virtual void addGateway(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::workspace::Gateway& gateway) = 0; virtual void updateGateway(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& gatewayId, const ::apache::airavata::model::workspace::Gateway& updatedGateway) = 0; virtual void getGateway( ::apache::airavata::model::workspace::Gateway& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& gatewayId) = 0; @@ -1739,7 +1741,7 @@ class AiravataIfSingletonFactory : virtual public AiravataIfFactory { class AiravataNull : virtual public AiravataIf { public: virtual ~AiravataNull() {} - void getAPIVersion(std::string& /* _return */) { + void getAPIVersion(std::string& /* _return */, const ::apache::airavata::model::security::AuthzToken& /* authzToken */) { return; } void addGateway(std::string& /* _return */, const ::apache::airavata::model::security::AuthzToken& /* authzToken */, const ::apache::airavata::model::workspace::Gateway& /* gateway */) { @@ -2134,8 +2136,8 @@ class AiravataNull : virtual public AiravataIf { class Airavata_getAPIVersion_args { public: - static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; - static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + static const char* ascii_fingerprint; // = "75A7E945AEBB96C8FA8998CBCEB31C27"; + static const uint8_t binary_fingerprint[16]; // = {0x75,0xA7,0xE9,0x45,0xAE,0xBB,0x96,0xC8,0xFA,0x89,0x98,0xCB,0xCE,0xB3,0x1C,0x27}; Airavata_getAPIVersion_args(const Airavata_getAPIVersion_args&); Airavata_getAPIVersion_args& operator=(const Airavata_getAPIVersion_args&); @@ -2143,9 +2145,14 @@ class Airavata_getAPIVersion_args { } virtual ~Airavata_getAPIVersion_args() throw(); + ::apache::airavata::model::security::AuthzToken authzToken; + + void __set_authzToken(const ::apache::airavata::model::security::AuthzToken& val); - bool operator == (const Airavata_getAPIVersion_args & /* rhs */) const + bool operator == (const Airavata_getAPIVersion_args & rhs) const { + if (!(authzToken == rhs.authzToken)) + return false; return true; } bool operator != (const Airavata_getAPIVersion_args &rhs) const { @@ -2164,11 +2171,12 @@ class Airavata_getAPIVersion_args { class Airavata_getAPIVersion_pargs { public: - static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; - static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + static const char* ascii_fingerprint; // = "75A7E945AEBB96C8FA8998CBCEB31C27"; + static const uint8_t binary_fingerprint[16]; // = {0x75,0xA7,0xE9,0x45,0xAE,0xBB,0x96,0xC8,0xFA,0x89,0x98,0xCB,0xCE,0xB3,0x1C,0x27}; virtual ~Airavata_getAPIVersion_pargs() throw(); + const ::apache::airavata::model::security::AuthzToken* authzToken; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -20675,8 +20683,8 @@ class AiravataClient : virtual public AiravataIf { boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } - void getAPIVersion(std::string& _return); - void send_getAPIVersion(); + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken); + void send_getAPIVersion(const ::apache::airavata::model::security::AuthzToken& authzToken); void recv_getAPIVersion(std::string& _return); void addGateway(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::workspace::Gateway& gateway); void send_addGateway(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::workspace::Gateway& gateway); @@ -21311,13 +21319,13 @@ class AiravataMultiface : virtual public AiravataIf { ifaces_.push_back(iface); } public: - void getAPIVersion(std::string& _return) { + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { - ifaces_[i]->getAPIVersion(_return); + ifaces_[i]->getAPIVersion(_return, authzToken); } - ifaces_[i]->getAPIVersion(_return); + ifaces_[i]->getAPIVersion(_return, authzToken); return; } http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp index 9649554..a1c5143 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp @@ -41,8 +41,10 @@ class AiravataHandler : virtual public AiravataIf { /** * Fetch Apache Airavata API version + * + * @param authzToken */ - void getAPIVersion(std::string& _return) { + void getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { // Your implementation goes here printf("getAPIVersion\n"); } http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index c068aa6..cab3cef 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -20,13 +20,14 @@ interface AiravataIf { /** * Fetch Apache Airavata API version * + * @param \Airavata\Model\Security\AuthzToken $authzToken * @return string * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException * @throws \Airavata\API\Error\AuthorizationException */ - public function getAPIVersion(); + public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken); /** * @param \Airavata\Model\Security\AuthzToken $authzToken * @param \Airavata\Model\Workspace\Gateway $gateway @@ -2554,15 +2555,16 @@ class AiravataClient implements \Airavata\API\AiravataIf { $this->output_ = $output ? $output : $input; } - public function getAPIVersion() + public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken) { - $this->send_getAPIVersion(); + $this->send_getAPIVersion($authzToken); return $this->recv_getAPIVersion(); } - public function send_getAPIVersion() + public function send_getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken) { $args = new \Airavata\API\Airavata_getAPIVersion_args(); + $args->authzToken = $authzToken; $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { @@ -10202,12 +10204,26 @@ class AiravataClient implements \Airavata\API\AiravataIf { class Airavata_getAPIVersion_args { static $_TSPEC; + /** + * @var \Airavata\Model\Security\AuthzToken + */ + public $authzToken = null; - public function __construct() { + public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( + 1 => array( + 'var' => 'authzToken', + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Security\AuthzToken', + ), ); } + if (is_array($vals)) { + if (isset($vals['authzToken'])) { + $this->authzToken = $vals['authzToken']; + } + } } public function getName() { @@ -10229,6 +10245,14 @@ class Airavata_getAPIVersion_args { } switch ($fid) { + case 1: + if ($ftype == TType::STRUCT) { + $this->authzToken = new \Airavata\Model\Security\AuthzToken(); + $xfer += $this->authzToken->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -10242,6 +10266,14 @@ class Airavata_getAPIVersion_args { public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('Airavata_getAPIVersion_args'); + if ($this->authzToken !== null) { + if (!is_object($this->authzToken)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1); + $xfer += $this->authzToken->write($output); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote index d67b26e..1cb2251 100755 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote @@ -24,7 +24,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') print('') print('Functions:') - print(' string getAPIVersion()') + print(' string getAPIVersion(AuthzToken authzToken)') print(' string addGateway(AuthzToken authzToken, Gateway gateway)') print(' void updateGateway(AuthzToken authzToken, string gatewayId, Gateway updatedGateway)') print(' Gateway getGateway(AuthzToken authzToken, string gatewayId)') @@ -199,10 +199,10 @@ client = Airavata.Client(protocol) transport.open() if cmd == 'getAPIVersion': - if len(args) != 0: - print('getAPIVersion requires 0 args') + if len(args) != 1: + print('getAPIVersion requires 1 args') sys.exit(1) - pp.pprint(client.getAPIVersion()) + pp.pprint(client.getAPIVersion(eval(args[0]),)) elif cmd == 'addGateway': if len(args) != 2: http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py index 99344f2..505e10b 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py @@ -18,9 +18,12 @@ except: class Iface: - def getAPIVersion(self): + def getAPIVersion(self, authzToken): """ Fetch Apache Airavata API version + + Parameters: + - authzToken """ pass @@ -2115,16 +2118,20 @@ class Client(Iface): self._oprot = oprot self._seqid = 0 - def getAPIVersion(self): + def getAPIVersion(self, authzToken): """ Fetch Apache Airavata API version + + Parameters: + - authzToken """ - self.send_getAPIVersion() + self.send_getAPIVersion(authzToken) return self.recv_getAPIVersion() - def send_getAPIVersion(self): + def send_getAPIVersion(self, authzToken): self._oprot.writeMessageBegin('getAPIVersion', TMessageType.CALL, self._seqid) args = getAPIVersion_args() + args.authzToken = authzToken args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -8335,7 +8342,7 @@ class Processor(Iface, TProcessor): iprot.readMessageEnd() result = getAPIVersion_result() try: - result.success = self._handler.getAPIVersion() + result.success = self._handler.getAPIVersion(args.authzToken) except apache.airavata.api.error.ttypes.InvalidRequestException, ire: result.ire = ire except apache.airavata.api.error.ttypes.AiravataClientException, ace: @@ -10705,10 +10712,19 @@ class Processor(Iface, TProcessor): # HELPER FUNCTIONS AND STRUCTURES class getAPIVersion_args: + """ + Attributes: + - authzToken + """ thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'authzToken', (apache.airavata.model.security.ttypes.AuthzToken, apache.airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ), # 1 ) + def __init__(self, authzToken=None,): + self.authzToken = authzToken + def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) @@ -10718,6 +10734,12 @@ class getAPIVersion_args: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.STRUCT: + self.authzToken = apache.airavata.model.security.ttypes.AuthzToken() + self.authzToken.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10728,15 +10750,22 @@ class getAPIVersion_args: oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return oprot.writeStructBegin('getAPIVersion_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def validate(self): + if self.authzToken is None: + raise TProtocol.TProtocolException(message='Required field authzToken is unset!') return def __hash__(self): value = 17 + value = (value * 31) ^ hash(self.authzToken) return value def __repr__(self): http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchBES.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchBES.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchBES.java index a4794d8..42314f2 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchBES.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchBES.java @@ -57,7 +57,7 @@ public class CreateLaunchBES { public static void main(String[] args) throws Exception { airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); - System.out.println("API version is " + airavataClient.getAPIVersion()); + System.out.println("API version is " + airavataClient.getAPIVersion(null)); // createGateway(); // getGateway("testGatewayId"); // registerApplications(); // run this only the first time http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index c89b1fe..d7a3668 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -85,7 +85,7 @@ public class CreateLaunchExperiment { public static void main(String[] args) throws Exception { airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); AuthzToken token = new AuthzToken("empty_token"); - System.out.println("API version is " + airavataClient.getAPIVersion()); + System.out.println("API version is " + airavataClient.getAPIVersion(null)); // registerApplications(); // run this only the first time createAndLaunchExp(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java index 5fa69ed..56049d4 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java @@ -53,7 +53,7 @@ public class CreateLaunchExperimentUS3 { public static void main(String[] args) { try { final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); - System.out.println("API version is " + airavata.getAPIVersion()); + System.out.println("API version is " + airavata.getAPIVersion(null)); // addDescriptors(); // final String expId = createUS3ExperimentForTrestles(airavata); final String expId = createUS3ExperimentForStampede(airavata); http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java index 24e55c5..280f2f3 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java @@ -65,7 +65,7 @@ public class RegisterOGCEUS3Application { public static void main(String[] args) { try { airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); - System.out.println("API version is " + airavataClient.getAPIVersion()); + System.out.println("API version is " + airavataClient.getAPIVersion(null)); //Register all compute hosts registerXSEDEHosts(); http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java index f0e0f35..c0a13ab 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java @@ -144,7 +144,7 @@ public class RegisterSampleApplications { public static void main(String[] args) { try { Airavata.Client airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); - System.out.println("API version is " + airavataClient.getAPIVersion()); + System.out.println("API version is " + airavataClient.getAPIVersion(null)); RegisterSampleApplications registerSampleApplications = new RegisterSampleApplications(airavataClient); http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java index 752f1cb..0bddd58 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java @@ -65,7 +65,7 @@ public class RegisterUS3Application { public static void main(String[] args) { try { airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); - System.out.println("API version is " + airavataClient.getAPIVersion()); + System.out.println("API version is " + airavataClient.getAPIVersion(null)); //Register all compute hosts registerXSEDEHosts(); http://git-wip-us.apache.org/repos/asf/airavata/blob/c139ecef/thrift-interface-descriptions/airavata-api/airavata_api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-api/airavata_api.thrift b/thrift-interface-descriptions/airavata-api/airavata_api.thrift index 7c892ed..5b64735 100644 --- a/thrift-interface-descriptions/airavata-api/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-api/airavata_api.thrift @@ -71,7 +71,7 @@ service Airavata { /** * Fetch Apache Airavata API version */ - string getAPIVersion() + string getAPIVersion(1: required security_model.AuthzToken authzToken) throws (1: airavata_errors.InvalidRequestException ire, 2: airavata_errors.AiravataClientException ace, 3: airavata_errors.AiravataSystemException ase,
