http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/gfac-config.yaml ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/gfac-config.yaml b/modules/configuration/server/src/main/resources/gfac-config.yaml deleted file mode 100644 index 7d580ab..0000000 --- a/modules/configuration/server/src/main/resources/gfac-config.yaml +++ /dev/null @@ -1,114 +0,0 @@ -################################################################## -# 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. -# -################################################################ - -jobSubmitters: - - submissionProtocol: SSH - taskClass: org.apache.airavata.gfac.impl.task.DefaultJobSubmissionTask -# properties: -# - userName: airavata -# passPhrase: airavata -# privateKeyPath: /path/to/the/privatekey -# publicKeyPath: /path/to/the/publickey -# hostName: remote.client.hostName - - - submissionProtocol: SSH_FORK - taskClass: org.apache.airavata.gfac.impl.task.ForkJobSubmissionTask - - - submissionProtocol: LOCAL - taskClass: org.apache.airavata.gfac.impl.task.LocalJobSubmissionTask - - - submissionProtocol: CLOUD - taskClass: org.apache.airavata.gfac.impl.task.AuroraJobSubmissionTask - -# Following job subbmitters are not yet implemented. - - # - submissionProtocol: GSISSH - # taskClass: org.apache.airavata.task.adapters.GSISSHJobSubmissionTask -commonTasks: - - type: SETUP - taskClass: org.apache.airavata.task.common.SetupTask - - - type: CLEANUP - taskClass: org.apache.airavata.task.common.CleanupTask - -fileTransferTasks: - - transferProtocol: SCP - taskClass: org.apache.airavata.gfac.impl.task.SCPDataStageTask - - transferProtocol: LOCAL - taskClass: org.apache.airavata.gfac.impl.task.SCPDataStageTask - -# If your client doen't run the same instance where airavata server is running then you need to comment above -# DataStageTask and uncomment SCPDataStageTask. To work with SCPDataStageTask, you either need to -# provide ssh keys or password. - -# - transferProtocol: SCP -# taskClass: org.apache.airavata.gfac.impl.task.SCPDataStageTask -# properties: -# - userName: airavata -# passPhrase: airavata -# privateKeyPath: /path/to/the/privatekey -# publicKeyPath: /path/to/the/publickey -# hostName: remote.client.hostName -# inputPath: /path/to/data/dir -## password: password - -# Following transfer tasks are not yet implemented. - #- transferProtocol: SFTP - # taskClass: org.apache.airavata.task.adapters.SFTPFileTransferTask - - #- transferProtocol: GRIDFTP - # taskClass: org.apache.airavata.task.adapters.GRIDFTPFileTransferTask - - #- transferProtocol: LOCAL - # taskClass: org.apache.airavata.task.adapters.LocalFileTransferTask - -resources: - - jobManagerType: PBS - commandOutputParser: org.apache.airavata.gfac.impl.job.PBSOutputParser - emailParser: org.apache.airavata.gfac.monitor.email.parser.PBSEmailParser - resourceEmailAddresses: - - [email protected] # gordon - - [email protected] # Bigred2 - - root <[email protected]> # Bigred2 - - root <[email protected]> # alamo - - - jobManagerType: SLURM - commandOutputParser: org.apache.airavata.gfac.impl.job.SlurmOutputParser - emailParser: org.apache.airavata.gfac.monitor.email.parser.SLURMEmailParser - resourceEmailAddresses: - - slurm@comet # comet - - [email protected] # stampede - - [email protected] # Lonestar 5 - - [email protected] # Jureca - - - jobManagerType: UGE - commandOutputParser: org.apache.airavata.gfac.impl.job.UGEOutputParser - emailParser: org.apache.airavata.gfac.monitor.email.parser.UGEEmailParser - resourceEmailAddresses: - - ls4.tacc.utexas.edu # contain Lonestar - - - jobManagerType: LSF - commandOutputParser: org.apache.airavata.gfac.impl.job.LSFOutputParser - emailParser: org.apache.airavata.gfac.monitor.email.parser.LSFEmailParser - resourceEmailAddresses: - - iu.xsede.edu # test resource mail address - - - jobManagerType: FORK - commandOutputParser: org.apache.airavata.gfac.impl.job.ForkOutputParser
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/gsissh.properties ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/gsissh.properties b/modules/configuration/server/src/main/resources/gsissh.properties deleted file mode 100644 index 3fdf76d..0000000 --- a/modules/configuration/server/src/main/resources/gsissh.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# 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. -# - -########################################################################### -# Specifies system level configurations as a key/value pairs. -########################################################################### - -StrictHostKeyChecking=no -ssh.session.timeout=360000 http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/log4j.properties b/modules/configuration/server/src/main/resources/log4j.properties deleted file mode 100644 index ee67028..0000000 --- a/modules/configuration/server/src/main/resources/log4j.properties +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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. -# - -# Set root category priority to INFO and its only appender to CONSOLE. -log4j.rootCategory=INFO, CONSOLE,LOGFILE -log4j.rootLogger=INFO, CONSOLE, LOGFILE - -# Set the enterprise logger priority to FATAL -log4j.logger.org.apache.axis2.enterprise=FATAL -log4j.logger.org.apache.airavata=INFO -log4j.logger.de.hunsicker.jalopy.io=FATAL -log4j.logger.httpclient.wire.header=FATAL -log4j.logger.org.apache.commons.httpclient=FATAL -log4j.logger.org.apache.zookeeper=FATAL -log4j.logger.org.globus=INFO -# following remove grouper info logs -log4j.logger.edu.internet2.middleware.grouper=FATAL -log4j.logger.org.hibernate=FATAL - -# CONSOLE is set to be a ConsoleAppender using a PatternLayout. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n - -# LOGFILE is set to be a File appender using a PatternLayout. -log4j.appender.LOGFILE=org.apache.log4j.DailyRollingFileAppender -log4j.appender.LOGFILE.File=../logs/airavata.log -#Rollover at midnight each day. -log4j.appender.LOGFILE.DatePattern='.'yyyy-MM-dd -log4j.appender.LOGFILE.Append=true -log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout -log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/logback.xml ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/logback.xml b/modules/configuration/server/src/main/resources/logback.xml deleted file mode 100644 index 4153f84..0000000 --- a/modules/configuration/server/src/main/resources/logback.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration> - - <property name="DEV_HOME" value="../logs" /> - - <appender name="FILE-AUDIT" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>../logs/airavata.log</file> - <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> - <Pattern> - %d{yyyy-MM-dd HH:mm:ss} [%thread] %level %logger{35} - %msg%n - </Pattern> - </encoder> - - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- rollover daily --> - <fileNamePattern>../logs/airavata.%d{yyyy-MM-dd}.%i.log - </fileNamePattern> - <timeBasedFileNamingAndTriggeringPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> - <maxFileSize>10MB</maxFileSize> - </timeBasedFileNamingAndTriggeringPolicy> - </rollingPolicy> - - </appender> - - <root level="info"> - <appender-ref ref="FILE-AUDIT" /> - </root> - -</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/wso2carbon.pem ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/wso2carbon.pem b/modules/configuration/server/src/main/resources/wso2carbon.pem deleted file mode 100644 index 8c02f03..0000000 Binary files a/modules/configuration/server/src/main/resources/wso2carbon.pem and /dev/null differ http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/configuration/server/src/main/resources/zoo.cfg ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/zoo.cfg b/modules/configuration/server/src/main/resources/zoo.cfg deleted file mode 100644 index add0758..0000000 --- a/modules/configuration/server/src/main/resources/zoo.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -tickTime=2000 -initLimit=10 -syncLimit=5 -dataDir=data -clientPort=2181 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/pom.xml b/modules/credential-store/credential-store-service/pom.xml deleted file mode 100644 index 8b736af..0000000 --- a/modules/credential-store/credential-store-service/pom.xml +++ /dev/null @@ -1,175 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!--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. --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata</artifactId> - <version>0.17-SNAPSHOT</version> - <relativePath>../../../pom.xml</relativePath> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-credential-store</artifactId> - <name>Airavata Credential Store</name> - <description>Module to manage credentials</description> - - <dependencies> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-credential-store-stubs</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-api</artifactId> - <version>${oa4mp.version}</version> - </dependency> - <dependency> - <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-loader-oauth1</artifactId> - <version>${oa4mp.version}</version> - <exclusions> - <exclusion> - <groupId>net.oauth.core</groupId> - <artifactId>oauth-httpclient4</artifactId> - </exclusion> - <exclusion> - <groupId>net.oauth.core</groupId> - <artifactId>oauth-consumer</artifactId> - </exclusion> - <exclusion> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - </exclusion> - <exclusion> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <!--<dependency>--> - <!--<groupId>mysql</groupId>--> - <!--<artifactId>mysql-connector-java</artifactId>--> - <!--<version>5.1.34</version>--> - <!--</dependency>--> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.7</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-server-configuration</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbyclient</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbynet</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbytools</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.4</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-commons</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jsch</artifactId> - <version>0.1.50</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-email</artifactId> - <version>1.3.2</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-io</artifactId> - <version>1.3.2</version> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbynet</artifactId> - <version>10.11.1.1</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <inherited>true</inherited> - <configuration> - <systemPropertyVariables> - <credential.module.directory>${basedir}</credential.module.directory> - </systemPropertyVariables> - <excludes> - <exclude>**/DAOBaseTestCase.java</exclude> - <exclude>**/MappingDAOTest.java</exclude> - </excludes> - <testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory> - </configuration> - </plugin> - </plugins> - <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> - <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory> - <testResources> - <testResource> - <directory>${project.basedir}/src/test/resources</directory> - </testResource> - </testResources> - </build> -</project> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java deleted file mode 100644 index 93b4e94..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential; - -import java.io.Serializable; -import java.util.Date; - -/** - * Any audit information related to a credential. - */ -public interface AuditInfo extends Serializable { - - /** - * Gets the community user associated with the credential. - * - * @return The community user associated with the credential. - */ - public CommunityUser getCommunityUser(); - - /** - * The portal user associated with the credential. - * - * @return The portal user name. - */ - public String getPortalUserId(); - - /** - * Get the time which credentials are persisted. - * - * @return Time credentials are persisted. - */ - public Date getTimePersisted(); - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java deleted file mode 100644 index 2856f36..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential; - -import java.io.Serializable; - -/** - * Represents the community user. - */ -public class CommunityUser implements Serializable { - - static final long serialVersionUID = 5783370135149452010L; - - private String gatewayName; - private String userName; - private String userEmail; - - public String getGatewayName() { - return gatewayName; - } - - public void setGatewayName(String gatewayName) { - this.gatewayName = gatewayName; - } - - public String getUserEmail() { - return userEmail; - } - - public void setUserEmail(String userEmail) { - this.userEmail = userEmail; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public CommunityUser(String gatewayName, String userName, String userEmail) { - this.gatewayName = gatewayName; - this.userName = userName; - this.userEmail = userEmail; - } - - public CommunityUser(String gatewayName, String userName) { - this.gatewayName = gatewayName; - this.userName = userName; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java deleted file mode 100644 index bef8363..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential; - -import java.io.Serializable; -import java.util.Date; - -/** - * This class represents the actual credential. The credential can be a certificate, user name password or a SSH key. As - * per now we only have certificate implementation. - */ -public abstract class Credential implements Serializable { - - private static final long serialVersionUID = -3653870227035604734L; - - private String portalUserName; - private Date persistedTime; - private String token; - private CredentialOwnerType credentialOwnerType = CredentialOwnerType.GATEWAY; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - private String description; - - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public void setPortalUserName(String userName) { - portalUserName = userName; - } - - public String getPortalUserName() { - return portalUserName; - } - - public void setCertificateRequestedTime(Date ts) { - persistedTime = ts; - } - - public Date getCertificateRequestedTime() { - return persistedTime; - } - - public CredentialOwnerType getCredentialOwnerType() { return credentialOwnerType; } - - public void setCredentialOwnerType(CredentialOwnerType credentialOwnerType) { this.credentialOwnerType = credentialOwnerType; } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java deleted file mode 100644 index 18f2ddf..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.airavata.credential.store.credential; - -/** - * Created by marcus on 11/23/16. - */ -public enum CredentialOwnerType { - GATEWAY(org.apache.airavata.credential.store.datamodel.CredentialOwnerType.GATEWAY), - USER(org.apache.airavata.credential.store.datamodel.CredentialOwnerType.USER); - - private org.apache.airavata.credential.store.datamodel.CredentialOwnerType datamodelType; - private CredentialOwnerType(org.apache.airavata.credential.store.datamodel.CredentialOwnerType datamodelType) { - this.datamodelType = datamodelType; - } - - public org.apache.airavata.credential.store.datamodel.CredentialOwnerType getDatamodelType() { - return datamodelType; - } - - public static CredentialOwnerType findByDataModelType(org.apache.airavata.credential.store.datamodel.CredentialOwnerType datamodelType) { - for( CredentialOwnerType credentialOwnerType : CredentialOwnerType.values() ) { - if (credentialOwnerType.datamodelType == datamodelType) { - return credentialOwnerType; - } - } - - throw new RuntimeException("No CredentialOwnerType found for data model CredentialOwnerType " + datamodelType); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java deleted file mode 100644 index 17ddb3f..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * 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. - * -*/ - -package org.apache.airavata.credential.store.credential.impl.certificate; - -import org.apache.airavata.credential.store.credential.AuditInfo; -import org.apache.airavata.credential.store.credential.CommunityUser; - -import javax.xml.bind.annotation.XmlRootElement; -import java.util.Date; - -/** - * Audit information related to community credential. - */ -@XmlRootElement -public class CertificateAuditInfo implements AuditInfo { - - private static final long serialVersionUID = 13213123L; - - private String gatewayName; - private String communityUserName; - private String portalUserName; - private Date credentialsRequestedTime; - private String notBefore; - private String notAfter; - private long credentialLifeTime; - - public String getGatewayName() { - return gatewayName; - } - - public void setGatewayName(String gatewayName) { - this.gatewayName = gatewayName; - } - - public void setCommunityUserName(String communityUserName) { - this.communityUserName = communityUserName; - } - - public void setPortalUserName(String portalUserName) { - this.portalUserName = portalUserName; - } - - public void setCredentialsRequestedTime(Date credentialsRequestedTime) { - this.credentialsRequestedTime = credentialsRequestedTime; - } - - public String getNotBefore() { - return notBefore; - } - - public void setNotBefore(String notBefore) { - this.notBefore = notBefore; - } - - public String getNotAfter() { - return notAfter; - } - - public void setNotAfter(String notAfter) { - this.notAfter = notAfter; - } - - public long getCredentialLifeTime() { - return credentialLifeTime; - } - - public void setCredentialLifeTime(long credentialLifeTime) { - this.credentialLifeTime = credentialLifeTime; - } - - public CommunityUser getCommunityUser() { - return new CommunityUser(gatewayName, communityUserName); - } - - public String getPortalUserId() { - return portalUserName; - } - - public Date getTimePersisted() { - return credentialsRequestedTime; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java deleted file mode 100644 index 16c3351..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential.impl.certificate; - -import org.apache.airavata.credential.store.credential.CommunityUser; -import org.apache.airavata.credential.store.credential.Credential; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; - -/** - * Represents the certificate credentials. - */ -public class CertificateCredential extends Credential { - - static final long serialVersionUID = 6603675553790734432L; - - /** - * The community user associated with this credentials. - */ - private CommunityUser communityUser; - - private String notAfter; - - private X509Certificate[] certificates; - - private PrivateKey privateKey; - - private long lifeTime; - - private String notBefore; - - public CertificateCredential() { - } - - public String getNotBefore() { - return notBefore; - } - - public void setNotBefore(String notBefore) { - this.notBefore = notBefore; - } - - public String getNotAfter() { - return notAfter; - } - - public void setNotAfter(String notAfter) { - this.notAfter = notAfter; - } - - public PrivateKey getPrivateKey() { - return privateKey; - } - - public void setPrivateKey(PrivateKey privateKey) { - this.privateKey = privateKey; - } - - public X509Certificate[] getCertificates() { - return certificates; - } - - public void setCertificates(X509Certificate[] certificate) { - this.certificates = certificate; - } - - public long getLifeTime() { - return lifeTime; - } - - public void setLifeTime(long lifeTime) { - this.lifeTime = lifeTime; - } - - public CommunityUser getCommunityUser() { - return communityUser; - } - - public void setCommunityUser(CommunityUser communityUser) { - this.communityUser = communityUser; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java deleted file mode 100644 index 21cc271..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential.impl.password; - -import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential; - -/** - * User name password credentials. - */ -public class PasswordCredential extends SSHCredential { - - private String userName; - private String password; - private String description; - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java deleted file mode 100644 index d41af21..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential.impl.ssh; - -import org.apache.airavata.credential.store.credential.Credential; -import java.io.Serializable; - -/** - * An SSH Credential class which is an extension of Airavata Credential - */ -public class SSHCredential extends Credential implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1277154647420198981L; - - private byte[] privatekey; - private byte[] publicKey; - private String passphrase; - private String gateway; - private String username; - - - public SSHCredential() { - } - - public SSHCredential(byte[] privatekey, byte[] publicKey, String passphrase, String gateway,String username) { - this.privatekey = privatekey; - this.publicKey = publicKey; - this.passphrase = passphrase; - this.gateway = gateway; - this.username = username; - this.setPortalUserName(username); - } - - public byte[] getPrivateKey() { - return privatekey; - } - - public void setPrivateKey(byte[] privatekey) { - this.privatekey = privatekey; - } - - public byte[] getPublicKey() { - return publicKey; - } - - public void setPublicKey(byte[] pubKey) { - this.publicKey = pubKey; - } - - public String getPassphrase() { - return passphrase; - } - - public void setPassphrase(String passphrase) { - this.passphrase = passphrase; - } - - public String getGateway() { - return gateway; - } - - public void setGateway(String gateway) { - this.gateway = gateway; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java deleted file mode 100644 index ac1f0df..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.credential.impl.ssh; - -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -import org.apache.airavata.credential.store.store.CredentialStoreException; -import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.RandomStringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.JSchException; -import com.jcraft.jsch.KeyPair; - -/** - * A class which generates an SSH credential - */ -public class SSHCredentialGenerator { - - private static Logger logger = LoggerFactory.getLogger(SSHCredentialWriter.class); - - /** - * - * @return a SSH Credential generated and encrypted using a randomly generated password - * @throws CredentialStoreException - */ - public SSHCredential generateCredential(String tokenId) throws CredentialStoreException { - JSch jsch=new JSch(); - try { - KeyPair kpair=KeyPair.genKeyPair(jsch, KeyPair.RSA); - File file; - - file = File.createTempFile("id_rsa", ""); - - String fileName = file.getAbsolutePath(); - - String password = generateRandomString(); - // We are encrypting the private key with the hash of (tokenId+password). - // Any client which wants to use this private key will also generate a hash and then use it to decrypt the key. - kpair.writePrivateKey(fileName,password.getBytes()); - kpair.writePublicKey(fileName + ".pub" , ""); - kpair.dispose(); - byte[] priKey = FileUtils.readFileToByteArray(new File(fileName)); - byte[] pubKey = FileUtils.readFileToByteArray(new File(fileName + ".pub")); - SSHCredential sshCredential = new SSHCredential(); - sshCredential.setPrivateKey(priKey); - sshCredential.setPublicKey(pubKey); - sshCredential.setPassphrase(password); - return sshCredential; - } catch (IOException e) { - logger.error("IO Exception when creating SSH credential ",e); - throw new CredentialStoreException("Unable to generate SSH Credential", e); - } catch (JSchException e) { - logger.error("JSch SSH credential creation exception ",e); - throw new CredentialStoreException("Unable to generate SSH Credential. JSch exception ", e); - } - } - - private String generateHash(String tokenId, String password) { - byte[] bytesOfMessage = new byte[0]; - try { - bytesOfMessage = password.getBytes("UTF-8"); - MessageDigest md = MessageDigest.getInstance("MD5"); - return new String( md.digest(bytesOfMessage)); - } catch (UnsupportedEncodingException e) { - logger.error(e.getMessage(), e); - } catch (NoSuchAlgorithmException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - // Generate a random alphanumberic string of 16 characters length - private String generateRandomString() { - return RandomStringUtils.randomAlphanumeric(16); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java deleted file mode 100644 index 62b6e27..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.airavata.credential.store.notifier;/* - * - * 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. - * - */ - - -import org.apache.airavata.credential.store.store.CredentialStoreException; - -/** - * This class is used to notify particular entity with expiring credentials. - * The default implementation uses email messages. - * User: AmilaJ ([email protected]) - * Date: 12/3/13 - * Time: 4:17 PM - */ -public interface CredentialStoreNotifier { - - /** - * The specific notifier implementation needs to implement following method. - * This method should actually deliver message to desired entity. - * @param message The actual message encapsulated - * @throws CredentialStoreException - */ - void notifyMessage(NotificationMessage message) throws CredentialStoreException; - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java deleted file mode 100644 index 96f0bd9..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.notifier; - -/** - * User: AmilaJ ([email protected]) - * Date: 12/3/13 - * Time: 4:21 PM - */ - -/** - * Encapsulates the notification message. - * Usually says particular credential is expiring and need to renew. - */ -public class NotificationMessage { - - protected String message; - - public NotificationMessage(String msg) { - this.message = msg; - } - - public String getMessage() { - return message; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java deleted file mode 100644 index 979dedc..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.notifier; - -/** - * User: AmilaJ ([email protected]) - * Date: 12/27/13 - * Time: 2:22 PM - */ - -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.DBUtil; -import org.apache.airavata.credential.store.credential.CommunityUser; -import org.apache.airavata.credential.store.credential.Credential; -import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential; -import org.apache.airavata.credential.store.notifier.impl.EmailNotificationMessage; -import org.apache.airavata.credential.store.notifier.impl.EmailNotifier; -import org.apache.airavata.credential.store.notifier.impl.EmailNotifierConfiguration; -import org.apache.airavata.credential.store.store.CredentialReader; -import org.apache.airavata.credential.store.store.CredentialStoreException; -import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl; -import org.apache.airavata.credential.store.util.Utility; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.ParseException; -import java.util.*; - -/** - * This class runs a timer. Periodically it checks for expiring credentials. - * Then if there are expiring credentials this will send an email. - */ -public class NotifierBootstrap extends TimerTask { - - private static boolean enabled = false; - - private static String MESSAGE = "Credentials for community user {0} expires at {1}"; - private static String SUBJECT = "Expiring credentials for user {0}"; - - private DBUtil dbUtil; - - private long period; - - protected static Logger log = LoggerFactory.getLogger(NotifierBootstrap.class); - - - private CredentialStoreNotifier credentialStoreNotifier; - - public NotifierBootstrap(long period, DBUtil db, EmailNotifierConfiguration configuration) { - this.period = period; - - // bootstrap - if (enabled) { - Timer timer = new Timer(); - timer.scheduleAtFixedRate(this, 0, period); - } - - this.dbUtil = db; - - this.credentialStoreNotifier = new EmailNotifier(configuration); - } - - - - public long getPeriod() { - return period; - } - - public void setPeriod(long period) { - this.period = period; - } - - public static boolean isEnabled() { - return enabled; - } - - public static void setEnabled(boolean enabled) { - NotifierBootstrap.enabled = enabled; - } - - @Override - public void run() { - - if (!enabled) - return; - - // retrieve OA4MP credentials - try { - CredentialReader credentialReader = new CredentialReaderImpl(this.dbUtil); - List<Credential> credentials = credentialReader.getAllCredentials(); - - for(Credential credential : credentials) { - if (credential instanceof CertificateCredential) { - CertificateCredential certificateCredential = (CertificateCredential)credential; - - Date date = Utility.convertStringToDate(certificateCredential.getNotAfter()); - date.setDate(date.getDate() + 1); // gap is 1 days - - Date currentDate = new Date(); - if (currentDate.after(date)) { - // Send an email - CommunityUser communityUser = certificateCredential.getCommunityUser(); - String body = - String.format(MESSAGE, communityUser.getUserName(), certificateCredential.getNotAfter()); - String subject = String.format(SUBJECT, communityUser.getUserName()); - NotificationMessage notificationMessage - = new EmailNotificationMessage(subject, communityUser.getUserEmail(), body); - - this.credentialStoreNotifier.notifyMessage(notificationMessage); - - } - } - } - - } catch (ApplicationSettingsException e) { - log.error("Error configuring email senders.", e); - } catch (CredentialStoreException e) { - log.error("Error sending emails about credential expiring.", e); - } catch (ParseException e) { - log.error("Error parsing date time when sending emails", e); - } - - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java deleted file mode 100644 index ffd84c8..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.notifier.impl; - -import org.apache.airavata.credential.store.notifier.NotificationMessage; - -/** - * User: AmilaJ ([email protected]) - * Date: 12/3/13 - * Time: 5:01 PM - */ - -public class EmailNotificationMessage extends NotificationMessage { - - public EmailNotificationMessage(String subject, String senderEmail, String msg) { - super(msg); - this.subject = subject; - this.senderEmail = senderEmail; - } - - private String subject; - private String senderEmail; - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public String getSenderEmail() { - return senderEmail; - } - - public void setSenderEmail(String senderEmail) { - this.senderEmail = senderEmail; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java deleted file mode 100644 index e52b211..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.notifier.impl; - -import org.apache.airavata.credential.store.notifier.CredentialStoreNotifier; -import org.apache.airavata.credential.store.notifier.NotificationMessage; -import org.apache.airavata.credential.store.store.CredentialStoreException; -import org.apache.commons.mail.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * User: AmilaJ ([email protected]) - * Date: 12/3/13 - * Time: 4:25 PM - */ - -public class EmailNotifier implements CredentialStoreNotifier { - - protected static Logger log = LoggerFactory.getLogger(EmailNotifier.class); - - private EmailNotifierConfiguration emailNotifierConfiguration; - - public EmailNotifier(EmailNotifierConfiguration notifierConfiguration) { - this.emailNotifierConfiguration = notifierConfiguration; - } - - public void notifyMessage(NotificationMessage message) throws CredentialStoreException { - try { - Email email = new SimpleEmail(); - email.setHostName(this.emailNotifierConfiguration.getEmailServer()); - email.setSmtpPort(this.emailNotifierConfiguration.getEmailServerPort()); - email.setAuthenticator(new DefaultAuthenticator(this.emailNotifierConfiguration.getEmailUserName(), - this.emailNotifierConfiguration.getEmailPassword())); - email.setSSLOnConnect(this.emailNotifierConfiguration.isSslConnect()); - email.setFrom(this.emailNotifierConfiguration.getFromAddress()); - - EmailNotificationMessage emailMessage = (EmailNotificationMessage)message; - - email.setSubject(emailMessage.getSubject()); - email.setMsg(emailMessage.getMessage()); - email.addTo(emailMessage.getSenderEmail()); - email.send(); - - } catch (EmailException e) { - log.error("[CredentialStore]Error sending email notification message."); - throw new CredentialStoreException("Error sending email notification message", e); - } - - - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java deleted file mode 100644 index b1a204f..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * 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. - * - */ - -package org.apache.airavata.credential.store.notifier.impl; - -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.ApplicationSettings; - -/** - * User: AmilaJ ([email protected]) - * Date: 12/3/13 - * Time: 5:06 PM - */ - -public class EmailNotifierConfiguration { - private String emailServer; - private int emailServerPort; - private String emailUserName; - private String emailPassword; - private boolean sslConnect; - private String fromAddress; - - public EmailNotifierConfiguration(String emailServer, int emailServerPort, String emailUserName, - String emailPassword, boolean sslConnect, String fromAddress) { - this.emailServer = emailServer; - this.emailServerPort = emailServerPort; - this.emailUserName = emailUserName; - this.emailPassword = emailPassword; - this.sslConnect = sslConnect; - this.fromAddress = fromAddress; - } - - public String getEmailServer() { - return emailServer; - } - - public int getEmailServerPort() { - return emailServerPort; - } - - public String getEmailUserName() { - return emailUserName; - } - - public String getEmailPassword() { - return emailPassword; - } - - public boolean isSslConnect() { - return sslConnect; - } - - public String getFromAddress() { - return fromAddress; - } - - public static EmailNotifierConfiguration getEmailNotifierConfigurations() throws ApplicationSettingsException { - return new EmailNotifierConfiguration(ApplicationSettings.getCredentialStoreEmailServer(), - Integer.parseInt(ApplicationSettings.getCredentialStoreEmailServerPort()), - ApplicationSettings.getCredentialStoreEmailUser(), - ApplicationSettings.getCredentialStoreEmailPassword(), - Boolean.parseBoolean(ApplicationSettings.getCredentialStoreEmailSSLConnect()), - ApplicationSettings.getCredentialStoreEmailFromEmail()); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java deleted file mode 100644 index 5ccec02..0000000 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * 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. - * - */ -package org.apache.airavata.credential.store.server; - - -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.credential.store.cpi.CredentialStoreService; -import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -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.InetSocketAddress; - -public class CredentialStoreServer implements IServer { - private final static Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class); - private static final String SERVER_NAME = "Credential Store Server"; - private static final String SERVER_VERSION = "1.0"; - - private IServer.ServerStatus status; - private TServer server; - - public CredentialStoreServer() { - setStatus(IServer.ServerStatus.STOPPED); - } - - @Override - public String getName() { - return SERVER_NAME; - } - - @Override - public String getVersion() { - return SERVER_VERSION; - } - - @Override - public void start() throws Exception { - try { - setStatus(ServerStatus.STARTING); - final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort()); - final String serverHost = ServerSettings.getCredentialStoreServerHost(); - CredentialStoreService.Processor processor = new CredentialStoreService.Processor(new CredentialStoreServerHandler()); - - TServerTransport serverTransport; - - if (serverHost == null) { - serverTransport = new TServerSocket(serverPort); - } else { - 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)); - - new Thread() { - public void run() { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Credential store Server Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (server.isServing()) { - setStatus(ServerStatus.STARTED); - logger.info("Starting Credential store Server on Port " + serverPort); - logger.info("Listening to Credential store clients ...."); - } - } - }.start(); - } catch (TTransportException e) { - setStatus(ServerStatus.FAILED); - throw new Exception("Error while starting the credential store service", e); - } - } - - public static void main(String[] args) { - try { - new CredentialStoreServer().start(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - @Override - public void stop() throws Exception { - if (server!=null && server.isServing()){ - setStatus(ServerStatus.STOPING); - server.stop(); - } - } - - @Override - public void restart() throws Exception { - stop(); - start(); - } - - @Override - public void configure() throws Exception { - - } - - @Override - public ServerStatus getStatus() throws Exception { - return status; - } - - private void setStatus(IServer.ServerStatus stat){ - status=stat; - status.updateTime(); - } - - public TServer getServer() { - return server; - } - - public void setServer(TServer server) { - this.server = server; - } - - -}
