You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/11/14 22:10:15 UTC
svn commit: r1409401 [2/2] - in /airavata/trunk/modules:
airavata-rest-services/ airavata-rest-services/src/main/webapp/WEB-INF/
security/ security/src/ security/src/main/ security/src/main/java/
security/src/main/java/org/ security/src/main/java/org/a...
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator2.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator2.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator2.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator2.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,43 @@
+package org.apache.airavata.security.configurations;
+
+import org.apache.airavata.security.AbstractDatabaseAuthenticator;
+import org.apache.airavata.security.AuthenticationException;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: thejaka
+ * Date: 9/6/12
+ * Time: 6:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestDBAuthenticator2 extends AbstractDatabaseAuthenticator {
+
+ public TestDBAuthenticator2() {
+ super();
+ }
+
+ @Override
+ public void onSuccessfulAuthentication(Object authenticationInfo) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void onFailedAuthentication(Object authenticationInfo) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean authenticate(Object credentials) throws AuthenticationException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ protected boolean doAuthentication(Object credentials) throws AuthenticationException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean isAuthenticated(Object credentials) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator3.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator3.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator3.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestDBAuthenticator3.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,43 @@
+package org.apache.airavata.security.configurations;
+
+import org.apache.airavata.security.AbstractDatabaseAuthenticator;
+import org.apache.airavata.security.AuthenticationException;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: thejaka
+ * Date: 9/6/12
+ * Time: 6:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestDBAuthenticator3 extends AbstractDatabaseAuthenticator {
+
+ public TestDBAuthenticator3() {
+ super();
+ }
+
+ @Override
+ public void onSuccessfulAuthentication(Object authenticationInfo) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void onFailedAuthentication(Object authenticationInfo) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean authenticate(Object credentials) throws AuthenticationException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ protected boolean doAuthentication(Object credentials) throws AuthenticationException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean isAuthenticated(Object credentials) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestUserStore.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestUserStore.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestUserStore.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/TestUserStore.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,47 @@
+/*
+ *
+ * *
+ * * 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.security.configurations;
+
+import org.apache.airavata.security.UserStore;
+import org.w3c.dom.Node;
+
+/**
+ * Test user store class.
+ */
+public class TestUserStore implements UserStore {
+ @Override
+ public boolean authenticate(String userName, Object credentials) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean authenticate(Object credentials) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void configure(Node node) throws RuntimeException {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,77 @@
+/*
+ *
+ * *
+ * * 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.security.userstore;
+
+import junit.framework.TestCase;
+import org.apache.airavata.security.Authenticator;
+import org.apache.airavata.security.UserStore;
+import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.util.List;
+
+/**
+ * Test class for JDBC user store.
+ */
+public class JDBCUserStoreTest extends TestCase {
+
+ /**
+ * <specificConfigurations>
+ <database>
+ <!--jdbcUrl>jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test</jdbcUrl-->
+ <jdbcUrl>jdbc:h2:src/test/resources/testdb/test</jdbcUrl>
+ <userName>sa</userName>
+ <password>sa</password>
+ <databaseDriver>org.h2.Driver</databaseDriver>
+ <userTableName>AIRAVATA_USER</userTableName>
+ <userNameColumnName>USERID</userNameColumnName>
+ <passwordColumnName>PASSWORD</passwordColumnName>
+ </database>
+ </specificConfigurations>
+ * @throws Exception
+ */
+
+
+
+ public void testAuthenticate() throws Exception {
+
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(this.getClass().getClassLoader().getResourceAsStream("jdbc-authenticator.xml"));
+ doc.getDocumentElement().normalize();
+
+ NodeList configurations = doc.getElementsByTagName("specificConfigurations");
+ UserStore userStore = new JDBCUserStore();
+ userStore.configure(configurations.item(0));
+
+ assertTrue(userStore.authenticate("amilaj", "secret"));
+ assertFalse(userStore.authenticate("amilaj", "1secret"));
+ assertFalse(userStore.authenticate("lahiru", "1234"));
+
+ }
+}
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ * *
+ * * 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.security.userstore;
+
+import junit.framework.TestCase;
+import org.apache.airavata.security.UserStore;
+import org.junit.Ignore;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+/**
+ * User store test 2
+ */
+@Ignore("Need LDAP server to run these tests")
+public class LDAPUserStoreTest extends TestCase{
+
+ private LDAPUserStore ldapUserStore;
+
+ public void setUp() {
+ ldapUserStore = new LDAPUserStore();
+
+ ldapUserStore.initializeLDAP("ldap://localhost:10389", "admin", "secret", "uid={0},ou=system");
+ }
+
+ public void testAuthenticate() throws Exception {
+ assertTrue(ldapUserStore.authenticate("amilaj", "secret"));
+ assertFalse(ldapUserStore.authenticate("amilaj", "secret1"));
+ }
+
+ public void testConfigure() throws Exception {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(this.getClass().getClassLoader().getResourceAsStream("ldap-authenticator.xml"));
+ doc.getDocumentElement().normalize();
+
+ NodeList configurations = doc.getElementsByTagName("specificConfigurations");
+ UserStore userStore = new LDAPUserStore();
+ userStore.configure(configurations.item(0));
+
+ assertTrue(userStore.authenticate("amilaj", "secret"));
+ }
+
+
+
+}
Added: airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java (added)
+++ airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java Wed Nov 14 21:10:13 2012
@@ -0,0 +1,63 @@
+/*
+ *
+ * *
+ * * 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.security.userstore;
+
+import junit.framework.TestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.InputStream;
+
+/**
+ * Test class for session DB authenticator.
+ */
+public class SessionDBUserStoreTest extends TestCase {
+
+ private SessionDBUserStore sessionDBUserStore = new SessionDBUserStore();
+
+ private InputStream configurationFileStream
+ = this.getClass().getClassLoader().getResourceAsStream("session-authenticator.xml");
+
+ public void setUp() throws Exception {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(configurationFileStream);
+ doc.getDocumentElement().normalize();
+
+ NodeList specificConfigurations = doc.getElementsByTagName("specificConfigurations");
+ sessionDBUserStore.configure(specificConfigurations.item(0));
+ }
+
+ public void testAuthenticate() throws Exception {
+ assertTrue(sessionDBUserStore.authenticate("1234"));
+
+ }
+
+ public void testAuthenticateFailure() throws Exception {
+ assertFalse(sessionDBUserStore.authenticate("12345"));
+ }
+}
Added: airavata/trunk/modules/security/src/test/resources/authenticators.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/authenticators.xml?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/authenticators.xml (added)
+++ airavata/trunk/modules/security/src/test/resources/authenticators.xml Wed Nov 14 21:10:13 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<!--
+This file contains a sample authenticator configuration. We can define all authenticators in this file. Each authenticator
+configuration has to start with tag "authenticator". The name is the name given to the authenticator. The actual
+authenticator implementation is implemented in the class. There are configurations specific to authenticators.
+Those configurations are reside inside <specificConfigurations> tags.
+-->
+
+<authenticators>
+ <authenticator name="dbAuthenticator1" class="org.apache.airavata.security.configurations.TestDBAuthenticator1"
+ enabled="true" priority="6" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql1</jdbcUrl>
+ <userName>mysql1</userName>
+ <password>secret1</password>
+ <databaseDriver>org.myqsql.Driver1</databaseDriver>
+ <sessionTable>Session1</sessionTable>
+ <sessionColumn>sessioncolumn</sessionColumn>
+ <comparingColumn>comparecolumn</comparingColumn>
+ <!-- TODO add datasource.name></datasource.name -->
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator2" class="org.apache.airavata.security.configurations.TestDBAuthenticator2"
+ enabled="true" priority="7" userstore="org.apache.airavata.security.userstore.LDAPUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql2</jdbcUrl>
+ <userName>mysql2</userName>
+ <password>secret2</password>
+ <databaseDriver>org.myqsql.Driver2</databaseDriver>
+ <sessionTable>Session2</sessionTable>
+ <sessionColumn>sessioncolumn2</sessionColumn>
+ <comparingColumn>comparecolumn2</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator4" class="org.apache.airavata.security.configurations.TestDBAuthenticator2"
+ enabled="false" priority="7" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql2</jdbcUrl>
+ <userName>mysql2</userName>
+ <password>secret2</password>
+ <databaseDriver>org.myqsql.Driver2</databaseDriver>
+ <sessionTable>Session2</sessionTable>
+ <sessionColumn>sessioncolumn2</sessionColumn>
+ <comparingColumn>comparecolumn2</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator3" class="org.apache.airavata.security.configurations.TestDBAuthenticator3"
+ enabled="true" priority="8" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql3</jdbcUrl>
+ <userName>mysql3</userName>
+ <password>secret3</password>
+ <databaseDriver>org.myqsql.Driver3</databaseDriver>
+ <sessionTable>Session3</sessionTable>
+ <sessionColumn>sessioncolumn3</sessionColumn>
+ <comparingColumn>comparecolumn3</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+</authenticators>
\ No newline at end of file
Added: airavata/trunk/modules/security/src/test/resources/disabled-authenticator.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/disabled-authenticator.xml?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/disabled-authenticator.xml (added)
+++ airavata/trunk/modules/security/src/test/resources/disabled-authenticator.xml Wed Nov 14 21:10:13 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<!--
+This file contains a sample authenticator configuration. We can define all authenticators in this file. Each authenticator
+configuration has to start with tag "authenticator". The name is the name given to the authenticator. The actual
+authenticator implementation is implemented in the class. There are configurations specific to authenticators.
+Those configurations are reside inside <specificConfigurations> tags.
+-->
+
+<authenticators enabled="false">
+ <authenticator name="dbAuthenticator1" class="org.apache.airavata.security.configurations.TestDBAuthenticator1"
+ enabled="true" priority="6" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql1</jdbcUrl>
+ <userName>mysql1</userName>
+ <password>secret1</password>
+ <databaseDriver>org.myqsql.Driver1</databaseDriver>
+ <sessionTable>Session1</sessionTable>
+ <sessionColumn>sessioncolumn</sessionColumn>
+ <comparingColumn>comparecolumn</comparingColumn>
+ <!-- TODO add datasource.name></datasource.name -->
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator2" class="org.apache.airavata.security.configurations.TestDBAuthenticator2"
+ enabled="true" priority="7" userstore="org.apache.airavata.security.userstore.LDAPUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql2</jdbcUrl>
+ <userName>mysql2</userName>
+ <password>secret2</password>
+ <databaseDriver>org.myqsql.Driver2</databaseDriver>
+ <sessionTable>Session2</sessionTable>
+ <sessionColumn>sessioncolumn2</sessionColumn>
+ <comparingColumn>comparecolumn2</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator4" class="org.apache.airavata.security.configurations.TestDBAuthenticator2"
+ enabled="false" priority="7" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql2</jdbcUrl>
+ <userName>mysql2</userName>
+ <password>secret2</password>
+ <databaseDriver>org.myqsql.Driver2</databaseDriver>
+ <sessionTable>Session2</sessionTable>
+ <sessionColumn>sessioncolumn2</sessionColumn>
+ <comparingColumn>comparecolumn2</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+ <authenticator name="dbAuthenticator3" class="org.apache.airavata.security.configurations.TestDBAuthenticator3"
+ enabled="true" priority="8" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <jdbcUrl>jdbc:sql:thin:@//myhost:1521/mysql3</jdbcUrl>
+ <userName>mysql3</userName>
+ <password>secret3</password>
+ <databaseDriver>org.myqsql.Driver3</databaseDriver>
+ <sessionTable>Session3</sessionTable>
+ <sessionColumn>sessioncolumn3</sessionColumn>
+ <comparingColumn>comparecolumn3</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+
+</authenticators>
\ No newline at end of file
Added: airavata/trunk/modules/security/src/test/resources/jdbc-authenticator.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/jdbc-authenticator.xml?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/jdbc-authenticator.xml (added)
+++ airavata/trunk/modules/security/src/test/resources/jdbc-authenticator.xml Wed Nov 14 21:10:13 2012
@@ -0,0 +1,39 @@
+<!--
+ ~ /*
+ ~ *
+ ~ * 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.
+ ~ *
+ ~ */
+ -->
+<authenticators>
+ <authenticator name="dbAuthenticator1" class="org.apache.airavata.security.configurations.TestDBAuthenticator1"
+ enabled="true" priority="6" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <database>
+ <!--jdbcUrl>jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test</jdbcUrl-->
+ <jdbcUrl>jdbc:h2:../../src/test/resources/testdb/test</jdbcUrl>
+ <userName>sa</userName>
+ <password>sa</password>
+ <databaseDriver>org.h2.Driver</databaseDriver>
+ <userTableName>AIRAVATA_USER</userTableName>
+ <userNameColumnName>USERID</userNameColumnName>
+ <passwordColumnName>PASSWORD</passwordColumnName>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+</authenticators>
Added: airavata/trunk/modules/security/src/test/resources/ldap-authenticator.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/ldap-authenticator.xml?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/ldap-authenticator.xml (added)
+++ airavata/trunk/modules/security/src/test/resources/ldap-authenticator.xml Wed Nov 14 21:10:13 2012
@@ -0,0 +1,41 @@
+<!--
+ ~ /*
+ ~ *
+ ~ * 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.
+ ~ *
+ ~ */
+ -->
+<authenticators>
+ <authenticator name="dbAuthenticator1" class="org.apache.airavata.security.configurations.TestDBAuthenticator1"
+ enabled="true" priority="6" userstore="org.apache.airavata.security.userstore.JDBCUserStore">
+ <specificConfigurations>
+ <ldap>
+ <!--
+ url - The URL which LDAP server is listening for requests
+ systemUser - The DN of the LDAP server connection user
+ systemUserPassword - The password of the LDAP server connection user
+ userDNTemplate - The DN structure of the users in LDAP
+ -->
+ <url>ldap://localhost:10389</url>
+ <systemUser>admin</systemUser>
+ <systemUserPassword>secret</systemUserPassword>
+ <userDNTemplate>uid={0},ou=system</userDNTemplate>
+ </ldap>
+ </specificConfigurations>
+ </authenticator>
+</authenticators>
Added: airavata/trunk/modules/security/src/test/resources/session-authenticator.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/session-authenticator.xml?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/session-authenticator.xml (added)
+++ airavata/trunk/modules/security/src/test/resources/session-authenticator.xml Wed Nov 14 21:10:13 2012
@@ -0,0 +1,44 @@
+<!--
+ ~ /*
+ ~ *
+ ~ * 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.
+ ~ *
+ ~ */
+ -->
+
+<authenticators>
+ <authenticator name="sessionAuthenticator" class="org.apache.airavata.services.registry.rest.security.session.SessionAuthenticator"
+ enabled="true" priority="6" userstore="org.apache.airavata.security.userstore.SessionDBUserStore">
+ <specificConfigurations>
+ <database>
+ <!--jdbcUrl>jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test</jdbcUrl-->
+ <!-- Points to /Users/thejaka/development/apache/airavata/trunk/modules/commons/airavata-registry-rest/target/tomcat6x/. -->
+ <jdbcUrl>jdbc:h2:../../src/test/resources/testdb/test</jdbcUrl>
+ <!--jdbcUrl>jdbc:h2:modules/security/src/test/resources/testdb/test</jdbcUrl-->
+
+ <userName>sa</userName>
+ <password>sa</password>
+ <databaseDriver>org.h2.Driver</databaseDriver>
+ <sessionTable>Persons</sessionTable>
+ <sessionColumn>sessionId</sessionColumn>
+ <comparingColumn>sessionId</comparingColumn>
+ </database>
+ </specificConfigurations>
+ </authenticator>
+ </authenticators>
+
Added: airavata/trunk/modules/security/src/test/resources/testdb/test.trace.db
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/testdb/test.trace.db?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/testdb/test.trace.db (added)
+++ airavata/trunk/modules/security/src/test/resources/testdb/test.trace.db Wed Nov 14 21:10:13 2012
@@ -0,0 +1,53 @@
+09-10 15:20:58 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Column "1234" not found; SQL statement:
+SELECT sessionId FROM Persons WHERE sessionId = "1234" [42122-168]
+ at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
+ at org.h2.message.DbException.get(DbException.java:169)
+ at org.h2.message.DbException.get(DbException.java:146)
+ at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:138)
+ at org.h2.expression.Comparison.optimize(Comparison.java:161)
+ at org.h2.command.dml.Select.prepare(Select.java:802)
+ at org.h2.command.Parser.prepareCommand(Parser.java:218)
+ at org.h2.engine.Session.prepareLocal(Session.java:415)
+ at org.h2.engine.Session.prepareCommand(Session.java:364)
+ at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1109)
+ at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:164)
+ at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
+ at org.h2.server.web.WebApp.getResult(WebApp.java:1311)
+ at org.h2.server.web.WebApp.query(WebApp.java:1001)
+ at org.h2.server.web.WebApp$1.next(WebApp.java:964)
+ at org.h2.server.web.WebApp$1.next(WebApp.java:967)
+ at org.h2.server.web.WebThread.process(WebThread.java:166)
+ at org.h2.server.web.WebThread.run(WebThread.java:93)
+ at java.lang.Thread.run(Thread.java:680)
+09-10 15:22:14 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Column "1234" not found; SQL statement:
+SELECT sessionID FROM Persons where sessionid="1234" [42122-168]
+ at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
+ at org.h2.message.DbException.get(DbException.java:169)
+ at org.h2.message.DbException.get(DbException.java:146)
+ at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:138)
+ at org.h2.expression.Comparison.optimize(Comparison.java:161)
+ at org.h2.command.dml.Select.prepare(Select.java:802)
+ at org.h2.command.Parser.prepareCommand(Parser.java:218)
+ at org.h2.engine.Session.prepareLocal(Session.java:415)
+ at org.h2.engine.Session.prepareCommand(Session.java:364)
+ at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1109)
+ at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:164)
+ at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
+ at org.h2.server.web.WebApp.getResult(WebApp.java:1311)
+ at org.h2.server.web.WebApp.query(WebApp.java:1001)
+ at org.h2.server.web.WebApp$1.next(WebApp.java:964)
+ at org.h2.server.web.WebApp$1.next(WebApp.java:967)
+ at org.h2.server.web.WebThread.process(WebThread.java:166)
+ at org.h2.server.web.WebThread.run(WebThread.java:93)
+ at java.lang.Thread.run(Thread.java:680)
+09-11 14:46:11 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "INSERT INTO AIRAVATA_USER (LASTNAME, FIRSTNAME , USERID , PASSWORD ) VALUE[*] ('Jayasekara', 'Amila', 'amilaj', 'secret') "; expected "DIRECT, SORTED, DEFAULT, VALUES, SET, (, SELECT, FROM"; SQL statement:
+insert into airavata_user (LastName, firstname , userid , password ) value ('Jayasekara', 'Amila', 'amilaj', 'secret') [42001-168]
+09-11 14:46:44 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "INSERT INTO AIRAVATA_USER (LASTNAME, FIRSTNAME , USERID , PASSWORD ) VALUE[*] ('Jayasekara', 'Amila', 'amilaj', 'secret') "; expected "DIRECT, SORTED, DEFAULT, VALUES, SET, (, SELECT, FROM"; SQL statement:
+insert into airavata_user (LastName, firstname , userid , password ) value ('Jayasekara', 'Amila', 'amilaj', 'secret') [42001-168]
+09-11 14:46:48 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "INSERT INTO AIRAVATA_USER (LASTNAME, FIRSTNAME , USERID , PASSWORD ) VALUE[*] ('Jayasekara', 'Amila', 'amilaj', 'secret') "; expected "DIRECT, SORTED, DEFAULT, VALUES, SET, (, SELECT, FROM"; SQL statement:
+insert into airavata_user (LastName, firstname , userid , password ) value ('Jayasekara', 'Amila', 'amilaj', 'secret') [42001-168]
Added: airavata/trunk/modules/security/src/test/resources/testdb/test/test.trace.db
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/testdb/test/test.trace.db?rev=1409401&view=auto
==============================================================================
--- airavata/trunk/modules/security/src/test/resources/testdb/test/test.trace.db (added)
+++ airavata/trunk/modules/security/src/test/resources/testdb/test/test.trace.db Wed Nov 14 21:10:13 2012
@@ -0,0 +1,6 @@
+09-04 16:20:30 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Table "TABLE" not found; SQL statement:
+delete table session [42102-168]
+09-04 16:20:40 jdbc[2]: exception
+org.h2.jdbc.JdbcSQLException: Table "TABLE" not found; SQL statement:
+delete table session [42102-168]