You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/08/02 19:48:24 UTC
airavata git commit: adding TLS mutual verification support for
Sharing Service
Repository: airavata
Updated Branches:
refs/heads/develop 6d6973d87 -> ad013e07a
adding TLS mutual verification support for Sharing Service
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ad013e07
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ad013e07
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ad013e07
Branch: refs/heads/develop
Commit: ad013e07a4fbf548c39b06abaa967adc39442de2
Parents: 6d6973d
Author: scnakandala <su...@gmail.com>
Authored: Wed Aug 2 15:48:17 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Wed Aug 2 15:48:17 2017 -0400
----------------------------------------------------------------------
.../airavata/model/tenant/TenantConfig.java | 728 +++++++++++++++++++
.../model/tenant/TenantPreferences.java | 622 ++++++++++++++++
.../apache/airavata/common/utils/Constants.java | 2 +
.../airavata/common/utils/ServerSettings.java | 4 +
.../main/resources/airavata-server.properties | 1 +
.../src/main/assembly/bin-assembly.xml | 4 +-
.../registry/server/SharingRegistryServer.java | 26 +-
.../src/main/resources/airavata.jks | Bin 0 -> 1410 bytes
.../src/main/resources/client_truststore.jks | Bin 0 -> 5312 bytes
.../registry/SharingRegistryServiceTest.java | 33 +-
.../src/test/resources/airavata.jks | Bin 0 -> 1410 bytes
.../src/test/resources/client_truststore.jks | Bin 0 -> 5312 bytes
12 files changed, 1397 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantConfig.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantConfig.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantConfig.java
new file mode 100644
index 0000000..827d58e
--- /dev/null
+++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantConfig.java
@@ -0,0 +1,728 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.airavata.model.tenant;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
+public class TenantConfig implements org.apache.thrift.TBase<TenantConfig, TenantConfig._Fields>, java.io.Serializable, Cloneable, Comparable<TenantConfig> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TenantConfig");
+
+ private static final org.apache.thrift.protocol.TField OAUTH_CLIENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("oauthClientId", org.apache.thrift.protocol.TType.STRING, (short)16);
+ private static final org.apache.thrift.protocol.TField OAUTH_CLIENT_SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("oauthClientSecret", org.apache.thrift.protocol.TType.STRING, (short)17);
+ private static final org.apache.thrift.protocol.TField IDENTITY_SERVER_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("identityServerUserName", org.apache.thrift.protocol.TType.STRING, (short)13);
+ private static final org.apache.thrift.protocol.TField IDENTITY_SERVER_PASSWORD_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("identityServerPasswordToken", org.apache.thrift.protocol.TType.STRING, (short)14);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TenantConfigStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TenantConfigTupleSchemeFactory());
+ }
+
+ private String oauthClientId; // optional
+ private String oauthClientSecret; // optional
+ private String identityServerUserName; // optional
+ private String identityServerPasswordToken; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ OAUTH_CLIENT_ID((short)16, "oauthClientId"),
+ OAUTH_CLIENT_SECRET((short)17, "oauthClientSecret"),
+ IDENTITY_SERVER_USER_NAME((short)13, "identityServerUserName"),
+ IDENTITY_SERVER_PASSWORD_TOKEN((short)14, "identityServerPasswordToken");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 16: // OAUTH_CLIENT_ID
+ return OAUTH_CLIENT_ID;
+ case 17: // OAUTH_CLIENT_SECRET
+ return OAUTH_CLIENT_SECRET;
+ case 13: // IDENTITY_SERVER_USER_NAME
+ return IDENTITY_SERVER_USER_NAME;
+ case 14: // IDENTITY_SERVER_PASSWORD_TOKEN
+ return IDENTITY_SERVER_PASSWORD_TOKEN;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final _Fields optionals[] = {_Fields.OAUTH_CLIENT_ID,_Fields.OAUTH_CLIENT_SECRET,_Fields.IDENTITY_SERVER_USER_NAME,_Fields.IDENTITY_SERVER_PASSWORD_TOKEN};
+ 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.OAUTH_CLIENT_ID, new org.apache.thrift.meta_data.FieldMetaData("oauthClientId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.OAUTH_CLIENT_SECRET, new org.apache.thrift.meta_data.FieldMetaData("oauthClientSecret", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.IDENTITY_SERVER_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("identityServerUserName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.IDENTITY_SERVER_PASSWORD_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("identityServerPasswordToken", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TenantConfig.class, metaDataMap);
+ }
+
+ public TenantConfig() {
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TenantConfig(TenantConfig other) {
+ if (other.isSetOauthClientId()) {
+ this.oauthClientId = other.oauthClientId;
+ }
+ if (other.isSetOauthClientSecret()) {
+ this.oauthClientSecret = other.oauthClientSecret;
+ }
+ if (other.isSetIdentityServerUserName()) {
+ this.identityServerUserName = other.identityServerUserName;
+ }
+ if (other.isSetIdentityServerPasswordToken()) {
+ this.identityServerPasswordToken = other.identityServerPasswordToken;
+ }
+ }
+
+ public TenantConfig deepCopy() {
+ return new TenantConfig(this);
+ }
+
+ @Override
+ public void clear() {
+ this.oauthClientId = null;
+ this.oauthClientSecret = null;
+ this.identityServerUserName = null;
+ this.identityServerPasswordToken = null;
+ }
+
+ public String getOauthClientId() {
+ return this.oauthClientId;
+ }
+
+ public void setOauthClientId(String oauthClientId) {
+ this.oauthClientId = oauthClientId;
+ }
+
+ public void unsetOauthClientId() {
+ this.oauthClientId = null;
+ }
+
+ /** Returns true if field oauthClientId is set (has been assigned a value) and false otherwise */
+ public boolean isSetOauthClientId() {
+ return this.oauthClientId != null;
+ }
+
+ public void setOauthClientIdIsSet(boolean value) {
+ if (!value) {
+ this.oauthClientId = null;
+ }
+ }
+
+ public String getOauthClientSecret() {
+ return this.oauthClientSecret;
+ }
+
+ public void setOauthClientSecret(String oauthClientSecret) {
+ this.oauthClientSecret = oauthClientSecret;
+ }
+
+ public void unsetOauthClientSecret() {
+ this.oauthClientSecret = null;
+ }
+
+ /** Returns true if field oauthClientSecret is set (has been assigned a value) and false otherwise */
+ public boolean isSetOauthClientSecret() {
+ return this.oauthClientSecret != null;
+ }
+
+ public void setOauthClientSecretIsSet(boolean value) {
+ if (!value) {
+ this.oauthClientSecret = null;
+ }
+ }
+
+ public String getIdentityServerUserName() {
+ return this.identityServerUserName;
+ }
+
+ public void setIdentityServerUserName(String identityServerUserName) {
+ this.identityServerUserName = identityServerUserName;
+ }
+
+ public void unsetIdentityServerUserName() {
+ this.identityServerUserName = null;
+ }
+
+ /** Returns true if field identityServerUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetIdentityServerUserName() {
+ return this.identityServerUserName != null;
+ }
+
+ public void setIdentityServerUserNameIsSet(boolean value) {
+ if (!value) {
+ this.identityServerUserName = null;
+ }
+ }
+
+ public String getIdentityServerPasswordToken() {
+ return this.identityServerPasswordToken;
+ }
+
+ public void setIdentityServerPasswordToken(String identityServerPasswordToken) {
+ this.identityServerPasswordToken = identityServerPasswordToken;
+ }
+
+ public void unsetIdentityServerPasswordToken() {
+ this.identityServerPasswordToken = null;
+ }
+
+ /** Returns true if field identityServerPasswordToken is set (has been assigned a value) and false otherwise */
+ public boolean isSetIdentityServerPasswordToken() {
+ return this.identityServerPasswordToken != null;
+ }
+
+ public void setIdentityServerPasswordTokenIsSet(boolean value) {
+ if (!value) {
+ this.identityServerPasswordToken = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case OAUTH_CLIENT_ID:
+ if (value == null) {
+ unsetOauthClientId();
+ } else {
+ setOauthClientId((String)value);
+ }
+ break;
+
+ case OAUTH_CLIENT_SECRET:
+ if (value == null) {
+ unsetOauthClientSecret();
+ } else {
+ setOauthClientSecret((String)value);
+ }
+ break;
+
+ case IDENTITY_SERVER_USER_NAME:
+ if (value == null) {
+ unsetIdentityServerUserName();
+ } else {
+ setIdentityServerUserName((String)value);
+ }
+ break;
+
+ case IDENTITY_SERVER_PASSWORD_TOKEN:
+ if (value == null) {
+ unsetIdentityServerPasswordToken();
+ } else {
+ setIdentityServerPasswordToken((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case OAUTH_CLIENT_ID:
+ return getOauthClientId();
+
+ case OAUTH_CLIENT_SECRET:
+ return getOauthClientSecret();
+
+ case IDENTITY_SERVER_USER_NAME:
+ return getIdentityServerUserName();
+
+ case IDENTITY_SERVER_PASSWORD_TOKEN:
+ return getIdentityServerPasswordToken();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case OAUTH_CLIENT_ID:
+ return isSetOauthClientId();
+ case OAUTH_CLIENT_SECRET:
+ return isSetOauthClientSecret();
+ case IDENTITY_SERVER_USER_NAME:
+ return isSetIdentityServerUserName();
+ case IDENTITY_SERVER_PASSWORD_TOKEN:
+ return isSetIdentityServerPasswordToken();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TenantConfig)
+ return this.equals((TenantConfig)that);
+ return false;
+ }
+
+ public boolean equals(TenantConfig that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_oauthClientId = true && this.isSetOauthClientId();
+ boolean that_present_oauthClientId = true && that.isSetOauthClientId();
+ if (this_present_oauthClientId || that_present_oauthClientId) {
+ if (!(this_present_oauthClientId && that_present_oauthClientId))
+ return false;
+ if (!this.oauthClientId.equals(that.oauthClientId))
+ return false;
+ }
+
+ boolean this_present_oauthClientSecret = true && this.isSetOauthClientSecret();
+ boolean that_present_oauthClientSecret = true && that.isSetOauthClientSecret();
+ if (this_present_oauthClientSecret || that_present_oauthClientSecret) {
+ if (!(this_present_oauthClientSecret && that_present_oauthClientSecret))
+ return false;
+ if (!this.oauthClientSecret.equals(that.oauthClientSecret))
+ return false;
+ }
+
+ boolean this_present_identityServerUserName = true && this.isSetIdentityServerUserName();
+ boolean that_present_identityServerUserName = true && that.isSetIdentityServerUserName();
+ if (this_present_identityServerUserName || that_present_identityServerUserName) {
+ if (!(this_present_identityServerUserName && that_present_identityServerUserName))
+ return false;
+ if (!this.identityServerUserName.equals(that.identityServerUserName))
+ return false;
+ }
+
+ boolean this_present_identityServerPasswordToken = true && this.isSetIdentityServerPasswordToken();
+ boolean that_present_identityServerPasswordToken = true && that.isSetIdentityServerPasswordToken();
+ if (this_present_identityServerPasswordToken || that_present_identityServerPasswordToken) {
+ if (!(this_present_identityServerPasswordToken && that_present_identityServerPasswordToken))
+ return false;
+ if (!this.identityServerPasswordToken.equals(that.identityServerPasswordToken))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_oauthClientId = true && (isSetOauthClientId());
+ list.add(present_oauthClientId);
+ if (present_oauthClientId)
+ list.add(oauthClientId);
+
+ boolean present_oauthClientSecret = true && (isSetOauthClientSecret());
+ list.add(present_oauthClientSecret);
+ if (present_oauthClientSecret)
+ list.add(oauthClientSecret);
+
+ boolean present_identityServerUserName = true && (isSetIdentityServerUserName());
+ list.add(present_identityServerUserName);
+ if (present_identityServerUserName)
+ list.add(identityServerUserName);
+
+ boolean present_identityServerPasswordToken = true && (isSetIdentityServerPasswordToken());
+ list.add(present_identityServerPasswordToken);
+ if (present_identityServerPasswordToken)
+ list.add(identityServerPasswordToken);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TenantConfig other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetOauthClientId()).compareTo(other.isSetOauthClientId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOauthClientId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oauthClientId, other.oauthClientId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetOauthClientSecret()).compareTo(other.isSetOauthClientSecret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOauthClientSecret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oauthClientSecret, other.oauthClientSecret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetIdentityServerUserName()).compareTo(other.isSetIdentityServerUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIdentityServerUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.identityServerUserName, other.identityServerUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetIdentityServerPasswordToken()).compareTo(other.isSetIdentityServerPasswordToken());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIdentityServerPasswordToken()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.identityServerPasswordToken, other.identityServerPasswordToken);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TenantConfig(");
+ boolean first = true;
+
+ if (isSetOauthClientId()) {
+ sb.append("oauthClientId:");
+ if (this.oauthClientId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.oauthClientId);
+ }
+ first = false;
+ }
+ if (isSetOauthClientSecret()) {
+ if (!first) sb.append(", ");
+ sb.append("oauthClientSecret:");
+ if (this.oauthClientSecret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.oauthClientSecret);
+ }
+ first = false;
+ }
+ if (isSetIdentityServerUserName()) {
+ if (!first) sb.append(", ");
+ sb.append("identityServerUserName:");
+ if (this.identityServerUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.identityServerUserName);
+ }
+ first = false;
+ }
+ if (isSetIdentityServerPasswordToken()) {
+ if (!first) sb.append(", ");
+ sb.append("identityServerPasswordToken:");
+ if (this.identityServerPasswordToken == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.identityServerPasswordToken);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TenantConfigStandardSchemeFactory implements SchemeFactory {
+ public TenantConfigStandardScheme getScheme() {
+ return new TenantConfigStandardScheme();
+ }
+ }
+
+ private static class TenantConfigStandardScheme extends StandardScheme<TenantConfig> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TenantConfig struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 16: // OAUTH_CLIENT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.oauthClientId = iprot.readString();
+ struct.setOauthClientIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 17: // OAUTH_CLIENT_SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.oauthClientSecret = iprot.readString();
+ struct.setOauthClientSecretIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 13: // IDENTITY_SERVER_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.identityServerUserName = iprot.readString();
+ struct.setIdentityServerUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 14: // IDENTITY_SERVER_PASSWORD_TOKEN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.identityServerPasswordToken = iprot.readString();
+ struct.setIdentityServerPasswordTokenIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TenantConfig struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.identityServerUserName != null) {
+ if (struct.isSetIdentityServerUserName()) {
+ oprot.writeFieldBegin(IDENTITY_SERVER_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.identityServerUserName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.identityServerPasswordToken != null) {
+ if (struct.isSetIdentityServerPasswordToken()) {
+ oprot.writeFieldBegin(IDENTITY_SERVER_PASSWORD_TOKEN_FIELD_DESC);
+ oprot.writeString(struct.identityServerPasswordToken);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.oauthClientId != null) {
+ if (struct.isSetOauthClientId()) {
+ oprot.writeFieldBegin(OAUTH_CLIENT_ID_FIELD_DESC);
+ oprot.writeString(struct.oauthClientId);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.oauthClientSecret != null) {
+ if (struct.isSetOauthClientSecret()) {
+ oprot.writeFieldBegin(OAUTH_CLIENT_SECRET_FIELD_DESC);
+ oprot.writeString(struct.oauthClientSecret);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TenantConfigTupleSchemeFactory implements SchemeFactory {
+ public TenantConfigTupleScheme getScheme() {
+ return new TenantConfigTupleScheme();
+ }
+ }
+
+ private static class TenantConfigTupleScheme extends TupleScheme<TenantConfig> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TenantConfig struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetOauthClientId()) {
+ optionals.set(0);
+ }
+ if (struct.isSetOauthClientSecret()) {
+ optionals.set(1);
+ }
+ if (struct.isSetIdentityServerUserName()) {
+ optionals.set(2);
+ }
+ if (struct.isSetIdentityServerPasswordToken()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetOauthClientId()) {
+ oprot.writeString(struct.oauthClientId);
+ }
+ if (struct.isSetOauthClientSecret()) {
+ oprot.writeString(struct.oauthClientSecret);
+ }
+ if (struct.isSetIdentityServerUserName()) {
+ oprot.writeString(struct.identityServerUserName);
+ }
+ if (struct.isSetIdentityServerPasswordToken()) {
+ oprot.writeString(struct.identityServerPasswordToken);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TenantConfig struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.oauthClientId = iprot.readString();
+ struct.setOauthClientIdIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.oauthClientSecret = iprot.readString();
+ struct.setOauthClientSecretIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.identityServerUserName = iprot.readString();
+ struct.setIdentityServerUserNameIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.identityServerPasswordToken = iprot.readString();
+ struct.setIdentityServerPasswordTokenIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantPreferences.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantPreferences.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantPreferences.java
new file mode 100644
index 0000000..6d505d8
--- /dev/null
+++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/tenant/TenantPreferences.java
@@ -0,0 +1,622 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.airavata.model.tenant;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
+public class TenantPreferences implements org.apache.thrift.TBase<TenantPreferences, TenantPreferences._Fields>, java.io.Serializable, Cloneable, Comparable<TenantPreferences> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TenantPreferences");
+
+ private static final org.apache.thrift.protocol.TField TENANT_ADMIN_FIRST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tenantAdminFirstName", org.apache.thrift.protocol.TType.STRING, (short)10);
+ private static final org.apache.thrift.protocol.TField TENANT_ADMIN_LAST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tenantAdminLastName", org.apache.thrift.protocol.TType.STRING, (short)11);
+ private static final org.apache.thrift.protocol.TField TENANT_ADMIN_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("tenantAdminEmail", org.apache.thrift.protocol.TType.STRING, (short)12);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TenantPreferencesStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TenantPreferencesTupleSchemeFactory());
+ }
+
+ private String tenantAdminFirstName; // optional
+ private String tenantAdminLastName; // optional
+ private String tenantAdminEmail; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ TENANT_ADMIN_FIRST_NAME((short)10, "tenantAdminFirstName"),
+ TENANT_ADMIN_LAST_NAME((short)11, "tenantAdminLastName"),
+ TENANT_ADMIN_EMAIL((short)12, "tenantAdminEmail");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 10: // TENANT_ADMIN_FIRST_NAME
+ return TENANT_ADMIN_FIRST_NAME;
+ case 11: // TENANT_ADMIN_LAST_NAME
+ return TENANT_ADMIN_LAST_NAME;
+ case 12: // TENANT_ADMIN_EMAIL
+ return TENANT_ADMIN_EMAIL;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final _Fields optionals[] = {_Fields.TENANT_ADMIN_FIRST_NAME,_Fields.TENANT_ADMIN_LAST_NAME,_Fields.TENANT_ADMIN_EMAIL};
+ 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.TENANT_ADMIN_FIRST_NAME, new org.apache.thrift.meta_data.FieldMetaData("tenantAdminFirstName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.TENANT_ADMIN_LAST_NAME, new org.apache.thrift.meta_data.FieldMetaData("tenantAdminLastName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.TENANT_ADMIN_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("tenantAdminEmail", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TenantPreferences.class, metaDataMap);
+ }
+
+ public TenantPreferences() {
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TenantPreferences(TenantPreferences other) {
+ if (other.isSetTenantAdminFirstName()) {
+ this.tenantAdminFirstName = other.tenantAdminFirstName;
+ }
+ if (other.isSetTenantAdminLastName()) {
+ this.tenantAdminLastName = other.tenantAdminLastName;
+ }
+ if (other.isSetTenantAdminEmail()) {
+ this.tenantAdminEmail = other.tenantAdminEmail;
+ }
+ }
+
+ public TenantPreferences deepCopy() {
+ return new TenantPreferences(this);
+ }
+
+ @Override
+ public void clear() {
+ this.tenantAdminFirstName = null;
+ this.tenantAdminLastName = null;
+ this.tenantAdminEmail = null;
+ }
+
+ public String getTenantAdminFirstName() {
+ return this.tenantAdminFirstName;
+ }
+
+ public void setTenantAdminFirstName(String tenantAdminFirstName) {
+ this.tenantAdminFirstName = tenantAdminFirstName;
+ }
+
+ public void unsetTenantAdminFirstName() {
+ this.tenantAdminFirstName = null;
+ }
+
+ /** Returns true if field tenantAdminFirstName is set (has been assigned a value) and false otherwise */
+ public boolean isSetTenantAdminFirstName() {
+ return this.tenantAdminFirstName != null;
+ }
+
+ public void setTenantAdminFirstNameIsSet(boolean value) {
+ if (!value) {
+ this.tenantAdminFirstName = null;
+ }
+ }
+
+ public String getTenantAdminLastName() {
+ return this.tenantAdminLastName;
+ }
+
+ public void setTenantAdminLastName(String tenantAdminLastName) {
+ this.tenantAdminLastName = tenantAdminLastName;
+ }
+
+ public void unsetTenantAdminLastName() {
+ this.tenantAdminLastName = null;
+ }
+
+ /** Returns true if field tenantAdminLastName is set (has been assigned a value) and false otherwise */
+ public boolean isSetTenantAdminLastName() {
+ return this.tenantAdminLastName != null;
+ }
+
+ public void setTenantAdminLastNameIsSet(boolean value) {
+ if (!value) {
+ this.tenantAdminLastName = null;
+ }
+ }
+
+ public String getTenantAdminEmail() {
+ return this.tenantAdminEmail;
+ }
+
+ public void setTenantAdminEmail(String tenantAdminEmail) {
+ this.tenantAdminEmail = tenantAdminEmail;
+ }
+
+ public void unsetTenantAdminEmail() {
+ this.tenantAdminEmail = null;
+ }
+
+ /** Returns true if field tenantAdminEmail is set (has been assigned a value) and false otherwise */
+ public boolean isSetTenantAdminEmail() {
+ return this.tenantAdminEmail != null;
+ }
+
+ public void setTenantAdminEmailIsSet(boolean value) {
+ if (!value) {
+ this.tenantAdminEmail = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TENANT_ADMIN_FIRST_NAME:
+ if (value == null) {
+ unsetTenantAdminFirstName();
+ } else {
+ setTenantAdminFirstName((String)value);
+ }
+ break;
+
+ case TENANT_ADMIN_LAST_NAME:
+ if (value == null) {
+ unsetTenantAdminLastName();
+ } else {
+ setTenantAdminLastName((String)value);
+ }
+ break;
+
+ case TENANT_ADMIN_EMAIL:
+ if (value == null) {
+ unsetTenantAdminEmail();
+ } else {
+ setTenantAdminEmail((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TENANT_ADMIN_FIRST_NAME:
+ return getTenantAdminFirstName();
+
+ case TENANT_ADMIN_LAST_NAME:
+ return getTenantAdminLastName();
+
+ case TENANT_ADMIN_EMAIL:
+ return getTenantAdminEmail();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case TENANT_ADMIN_FIRST_NAME:
+ return isSetTenantAdminFirstName();
+ case TENANT_ADMIN_LAST_NAME:
+ return isSetTenantAdminLastName();
+ case TENANT_ADMIN_EMAIL:
+ return isSetTenantAdminEmail();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TenantPreferences)
+ return this.equals((TenantPreferences)that);
+ return false;
+ }
+
+ public boolean equals(TenantPreferences that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_tenantAdminFirstName = true && this.isSetTenantAdminFirstName();
+ boolean that_present_tenantAdminFirstName = true && that.isSetTenantAdminFirstName();
+ if (this_present_tenantAdminFirstName || that_present_tenantAdminFirstName) {
+ if (!(this_present_tenantAdminFirstName && that_present_tenantAdminFirstName))
+ return false;
+ if (!this.tenantAdminFirstName.equals(that.tenantAdminFirstName))
+ return false;
+ }
+
+ boolean this_present_tenantAdminLastName = true && this.isSetTenantAdminLastName();
+ boolean that_present_tenantAdminLastName = true && that.isSetTenantAdminLastName();
+ if (this_present_tenantAdminLastName || that_present_tenantAdminLastName) {
+ if (!(this_present_tenantAdminLastName && that_present_tenantAdminLastName))
+ return false;
+ if (!this.tenantAdminLastName.equals(that.tenantAdminLastName))
+ return false;
+ }
+
+ boolean this_present_tenantAdminEmail = true && this.isSetTenantAdminEmail();
+ boolean that_present_tenantAdminEmail = true && that.isSetTenantAdminEmail();
+ if (this_present_tenantAdminEmail || that_present_tenantAdminEmail) {
+ if (!(this_present_tenantAdminEmail && that_present_tenantAdminEmail))
+ return false;
+ if (!this.tenantAdminEmail.equals(that.tenantAdminEmail))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_tenantAdminFirstName = true && (isSetTenantAdminFirstName());
+ list.add(present_tenantAdminFirstName);
+ if (present_tenantAdminFirstName)
+ list.add(tenantAdminFirstName);
+
+ boolean present_tenantAdminLastName = true && (isSetTenantAdminLastName());
+ list.add(present_tenantAdminLastName);
+ if (present_tenantAdminLastName)
+ list.add(tenantAdminLastName);
+
+ boolean present_tenantAdminEmail = true && (isSetTenantAdminEmail());
+ list.add(present_tenantAdminEmail);
+ if (present_tenantAdminEmail)
+ list.add(tenantAdminEmail);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TenantPreferences other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetTenantAdminFirstName()).compareTo(other.isSetTenantAdminFirstName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTenantAdminFirstName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenantAdminFirstName, other.tenantAdminFirstName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTenantAdminLastName()).compareTo(other.isSetTenantAdminLastName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTenantAdminLastName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenantAdminLastName, other.tenantAdminLastName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTenantAdminEmail()).compareTo(other.isSetTenantAdminEmail());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTenantAdminEmail()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenantAdminEmail, other.tenantAdminEmail);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TenantPreferences(");
+ boolean first = true;
+
+ if (isSetTenantAdminFirstName()) {
+ sb.append("tenantAdminFirstName:");
+ if (this.tenantAdminFirstName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tenantAdminFirstName);
+ }
+ first = false;
+ }
+ if (isSetTenantAdminLastName()) {
+ if (!first) sb.append(", ");
+ sb.append("tenantAdminLastName:");
+ if (this.tenantAdminLastName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tenantAdminLastName);
+ }
+ first = false;
+ }
+ if (isSetTenantAdminEmail()) {
+ if (!first) sb.append(", ");
+ sb.append("tenantAdminEmail:");
+ if (this.tenantAdminEmail == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tenantAdminEmail);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TenantPreferencesStandardSchemeFactory implements SchemeFactory {
+ public TenantPreferencesStandardScheme getScheme() {
+ return new TenantPreferencesStandardScheme();
+ }
+ }
+
+ private static class TenantPreferencesStandardScheme extends StandardScheme<TenantPreferences> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TenantPreferences struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 10: // TENANT_ADMIN_FIRST_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.tenantAdminFirstName = iprot.readString();
+ struct.setTenantAdminFirstNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 11: // TENANT_ADMIN_LAST_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.tenantAdminLastName = iprot.readString();
+ struct.setTenantAdminLastNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 12: // TENANT_ADMIN_EMAIL
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.tenantAdminEmail = iprot.readString();
+ struct.setTenantAdminEmailIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TenantPreferences struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.tenantAdminFirstName != null) {
+ if (struct.isSetTenantAdminFirstName()) {
+ oprot.writeFieldBegin(TENANT_ADMIN_FIRST_NAME_FIELD_DESC);
+ oprot.writeString(struct.tenantAdminFirstName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.tenantAdminLastName != null) {
+ if (struct.isSetTenantAdminLastName()) {
+ oprot.writeFieldBegin(TENANT_ADMIN_LAST_NAME_FIELD_DESC);
+ oprot.writeString(struct.tenantAdminLastName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.tenantAdminEmail != null) {
+ if (struct.isSetTenantAdminEmail()) {
+ oprot.writeFieldBegin(TENANT_ADMIN_EMAIL_FIELD_DESC);
+ oprot.writeString(struct.tenantAdminEmail);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TenantPreferencesTupleSchemeFactory implements SchemeFactory {
+ public TenantPreferencesTupleScheme getScheme() {
+ return new TenantPreferencesTupleScheme();
+ }
+ }
+
+ private static class TenantPreferencesTupleScheme extends TupleScheme<TenantPreferences> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TenantPreferences struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetTenantAdminFirstName()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTenantAdminLastName()) {
+ optionals.set(1);
+ }
+ if (struct.isSetTenantAdminEmail()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetTenantAdminFirstName()) {
+ oprot.writeString(struct.tenantAdminFirstName);
+ }
+ if (struct.isSetTenantAdminLastName()) {
+ oprot.writeString(struct.tenantAdminLastName);
+ }
+ if (struct.isSetTenantAdminEmail()) {
+ oprot.writeString(struct.tenantAdminEmail);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TenantPreferences struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.tenantAdminFirstName = iprot.readString();
+ struct.setTenantAdminFirstNameIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.tenantAdminLastName = iprot.readString();
+ struct.setTenantAdminLastNameIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.tenantAdminEmail = iprot.readString();
+ struct.setTenantAdminEmailIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java
index 38d0758..c5e2a79 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java
@@ -39,6 +39,8 @@ public final class Constants {
public static final String KEYSTORE_PASSWORD = "keystore.password";
public static final String TLS_CLIENT_TIMEOUT = "TLS.client.timeout";
+ public static final String IS_SHARING_TLS_ENABLED = "sharing.tls.enabled";
+
public static final String API_METHOD_NAME = "api.method.name";
//constants in XACML authorization response.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
index 8824eda..4ff58d3 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
@@ -405,6 +405,10 @@ public class ServerSettings extends ApplicationSettings {
return Boolean.valueOf(getSetting(Constants.IS_TLS_ENABLED));
}
+ public static boolean isSharingTLSEnabled() throws ApplicationSettingsException {
+ return Boolean.valueOf(getSetting(Constants.IS_SHARING_TLS_ENABLED));
+ }
+
public static int getTLSServerPort() throws ApplicationSettingsException {
return Integer.valueOf(getSetting(Constants.TLS_SERVER_PORT));
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index bf0bc6f..8c58280 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -115,6 +115,7 @@ sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION
sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer
sharing.registry.server.host=localhost
sharing.registry.server.port=7878
+sharing.tls.enabled=false
###########################################################################
# Server module Configuration
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-distribution/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-distribution/src/main/assembly/bin-assembly.xml b/modules/sharing-registry/sharing-registry-distribution/src/main/assembly/bin-assembly.xml
index 1bcedbb..038a065 100644
--- a/modules/sharing-registry/sharing-registry-distribution/src/main/assembly/bin-assembly.xml
+++ b/modules/sharing-registry/sharing-registry-distribution/src/main/assembly/bin-assembly.xml
@@ -40,13 +40,15 @@
<fileMode>755</fileMode>
</fileSet>
- <!-- ********************** copy airavata-server.properties ********************** -->
+ <!-- ********************** copy airavata-server.properties and key stores ********************** -->
<fileSet>
<directory>../../configuration/server/src/main/resources/</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>airavata-server.properties</include>
<include>log4j.properties</include>
+ <include>airavata.jks</include>
+ <include>client_truststore.jks</include>
</includes>
</fileSet>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
index 0cca07a..305c266 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
@@ -28,12 +28,14 @@ import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
import org.apache.airavata.sharing.registry.utils.Constants;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TSSLTransportFactory;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.net.InetAddress;
import java.net.InetSocketAddress;
public class SharingRegistryServer implements IServer {
@@ -73,15 +75,24 @@ public class SharingRegistryServer implements IServer {
TServerTransport serverTransport;
- if (serverHost == null) {
- serverTransport = new TServerSocket(serverPort);
- } else {
+ if (!ServerSettings.isSharingTLSEnabled()) {
InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
serverTransport = new TServerSocket(inetSocketAddress);
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+ options.minWorkerThreads = 30;
+ server = new TThreadPoolServer(options.processor(processor));
+ }else{
+ TSSLTransportFactory.TSSLTransportParameters TLSParams =
+ new TSSLTransportFactory.TSSLTransportParameters();
+ TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
+ TLSParams.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword());
+ TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket(
+ serverPort, ServerSettings.getTLSClientTimeout(),
+ InetAddress.getByName(serverHost), TLSParams);
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(TLSServerTransport);
+ options.minWorkerThreads = 30;
+ server = new TThreadPoolServer(options.processor(processor));
}
- TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
- options.minWorkerThreads = 30;
- server = new TThreadPoolServer(options.processor(processor));
new Thread() {
public void run() {
@@ -102,18 +113,15 @@ public class SharingRegistryServer implements IServer {
if (server.isServing()) {
try {
-
logger.info("Register sharing service with DB Event publishers");
SharingServiceDBEventMessagingFactory.registerSharingServiceWithPublishers(Constants.PUBLISHERS);
logger.info("Start sharing service DB Event subscriber");
SharingServiceDBEventMessagingFactory.getDBEventSubscriber();
-
} catch (AiravataException | SharingRegistryException e) {
logger.error("Error starting sharing service. Error setting up DB event services.");
server.stop();
}
-
setStatus(IServer.ServerStatus.STARTED);
logger.info("Starting Sharing Registry Server on Port " + serverPort);
logger.info("Listening to Sharing Registry server clients ....");
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/main/resources/airavata.jks
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/airavata.jks b/modules/sharing-registry/sharing-registry-server/src/main/resources/airavata.jks
new file mode 100644
index 0000000..e0e46e2
Binary files /dev/null and b/modules/sharing-registry/sharing-registry-server/src/main/resources/airavata.jks differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/main/resources/client_truststore.jks
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/client_truststore.jks b/modules/sharing-registry/sharing-registry-server/src/main/resources/client_truststore.jks
new file mode 100644
index 0000000..4ff588f
Binary files /dev/null and b/modules/sharing-registry/sharing-registry-server/src/main/resources/client_truststore.jks differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
index 21b8bf2..0957b87 100644
--- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
@@ -19,18 +19,19 @@
*/
package org.apache.airavata.sharing.registry;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.sharing.registry.models.*;
import org.apache.airavata.sharing.registry.server.ServerMain;
import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSSLTransportFactory;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
-import org.databene.contiperf.junit.ContiPerfRule;
import org.junit.Assert;
import org.junit.BeforeClass;
-import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,9 +42,6 @@ import java.util.Arrays;
public class SharingRegistryServiceTest {
private final static Logger logger = LoggerFactory.getLogger(SharingRegistryServiceTest.class);
- @Rule
- public ContiPerfRule i = new ContiPerfRule();
-
@BeforeClass
public static void setUp() throws InterruptedException {
ServerMain serverMain = new ServerMain();
@@ -53,15 +51,26 @@ public class SharingRegistryServiceTest {
@Test
-// @PerfTest(invocations = 50, threads = 10)
- public void test() throws TException, InterruptedException {
+ public void test() throws TException, InterruptedException, ApplicationSettingsException {
String serverHost = "localhost";
int serverPort = 7878;
- TTransport transport = new TSocket(serverHost, serverPort);
- transport.open();
- TProtocol protocol = new TBinaryProtocol(transport);
- SharingRegistryService.Client sharingServiceClient = new SharingRegistryService.Client(protocol);
+ SharingRegistryService.Client sharingServiceClient;
+ if (!ServerSettings.isSharingTLSEnabled()) {
+ TTransport transport = new TSocket(serverHost, serverPort);
+ transport.open();
+ TProtocol protocol = new TBinaryProtocol(transport);
+ sharingServiceClient = new SharingRegistryService.Client(protocol);
+ }else{
+ TSSLTransportFactory.TSSLTransportParameters params =
+ new TSSLTransportFactory.TSSLTransportParameters();
+ params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
+ params.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword());
+
+ TTransport transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params);
+ TProtocol protocol = new TBinaryProtocol(transport);
+ sharingServiceClient = new SharingRegistryService.Client(protocol);
+ }
Domain domain = new Domain();
//has to be one word
@@ -354,7 +363,5 @@ public class SharingRegistryServiceTest {
searchCriteria.setSearchField(EntitySearchField.OWNER_ID);
filters.add(searchCriteria);
Assert.assertTrue(sharingServiceClient.searchEntities(domainId, "test-user-2", filters, 0, -1).size() == 0);
-
- transport.close();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/test/resources/airavata.jks
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/resources/airavata.jks b/modules/sharing-registry/sharing-registry-server/src/test/resources/airavata.jks
new file mode 100644
index 0000000..e0e46e2
Binary files /dev/null and b/modules/sharing-registry/sharing-registry-server/src/test/resources/airavata.jks differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/ad013e07/modules/sharing-registry/sharing-registry-server/src/test/resources/client_truststore.jks
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/resources/client_truststore.jks b/modules/sharing-registry/sharing-registry-server/src/test/resources/client_truststore.jks
new file mode 100644
index 0000000..4ff588f
Binary files /dev/null and b/modules/sharing-registry/sharing-registry-server/src/test/resources/client_truststore.jks differ