airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1384499 [2/3] - in /incubator/airavata/sandbox/airavata-rest-security: ./ modules/ modules/commons/ modules/commons/airavata-registry-rest/ modules/commons/airavata-registry-rest/src/ modules/commons/airavata-registry-rest/src/main/ module...
Date Thu, 13 Sep 2012 20:03:49 GMT
Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,158 @@
+package org.apache.airavata.services.registry.rest.security;
+
+import org.apache.airavata.security.AuthenticationException;
+import org.apache.airavata.security.Authenticator;
+import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * A servlet filter class which intercepts the request and do authentication.
+ */
+public class HttpAuthenticatorFilter implements Filter {
+
+    private List<Authenticator> authenticatorList;
+
+    private static Logger log = LoggerFactory.getLogger(HttpAuthenticatorFilter.class);
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+        String authenticatorConfiguration = filterConfig.getInitParameter("authenticatorConfigurations");
+
+        //TODO make this able to read from a file as well
+
+
+        InputStream configurationFileStream = HttpAuthenticatorFilter.class.getClassLoader().
+                getResourceAsStream(authenticatorConfiguration);
+
+        if (configurationFileStream == null) {
+            String msg = "Invalid authenticator configuration. Cannot read file - ".concat(authenticatorConfiguration);
+            log.error(msg);
+            throw new ServletException(msg);
+        }
+
+        AuthenticatorConfigurationReader authenticatorConfigurationReader
+                = new AuthenticatorConfigurationReader();
+        try {
+            authenticatorConfigurationReader.init(configurationFileStream);
+        } catch (IOException e) {
+            String msg = "Error reading authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } catch (ParserConfigurationException e) {
+            String msg = "Error parsing authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } catch (SAXException e) {
+            String msg = "Error parsing authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } finally {
+            try {
+                configurationFileStream.close();
+            } catch (IOException e) {
+                log.error("Error closing authenticator file stream.", e);
+            }
+        }
+
+        this.authenticatorList = authenticatorConfigurationReader.getAuthenticatorList();
+
+        if (this.authenticatorList.isEmpty()) {
+            String msg = "No authenticators registered in the system. System cannot function without authenticators";
+            log.error(msg);
+            throw new ServletException(msg);
+        }
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+
+        Authenticator authenticator = getAuthenticator(httpServletRequest);
+
+        if (authenticator == null) {
+            //sendUnauthorisedError(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+            populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+        } else {
+            if (authenticator.isAuthenticated(httpServletRequest)) {
+                // Allow request to flow
+                filterChain.doFilter(servletRequest, servletResponse);
+            } else {
+                try {
+                    if (!authenticator.authenticate(httpServletRequest)) {
+                        //sendUnauthorisedError(servletResponse, "Unauthorised : Provided credentials are not valid.");
+                        populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+                    } else {
+                        // Allow request to flow
+                        filterChain.doFilter(servletRequest, servletResponse);
+                    }
+                } catch (AuthenticationException e) {
+                    String msg = "An error occurred while authenticating request.";
+                    log.error(msg, e);
+                    //sendUnauthorisedError(servletResponse, e.getMessage());
+                    populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+                }
+            }
+        }
+    }
+
+    protected void sendUnauthorisedError(ServletResponse servletResponse, String message) throws IOException {
+        HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
+        httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
+    }
+
+    @Override
+    public void destroy() {
+        if (this.authenticatorList != null) {
+            this.authenticatorList.clear();
+        }
+
+        this.authenticatorList = null;
+    }
+
+    private Authenticator getAuthenticator(HttpServletRequest httpServletRequest) {
+
+        for (Authenticator authenticator : authenticatorList) {
+            if (authenticator.canProcess(httpServletRequest)) {
+                return authenticator;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * This method will create a 401 unauthorized response to be sent.
+     *
+     * @param servletResponse The HTTP response.
+     */
+    private void populateUnauthorisedData(ServletResponse servletResponse, String message) {
+
+        HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse;
+
+        httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+        httpServletResponse.addHeader("Server", "Airavata Server");
+        httpServletResponse.addHeader("Description", message);
+        httpServletResponse.addDateHeader("Date", Calendar.getInstance().getTimeInMillis());
+        httpServletResponse.addHeader("WWW-Authenticate", "Basic realm=Airavata");
+        httpServletResponse.setContentType("text/html");
+
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,269 @@
+package org.apache.airavata.services.registry.rest.security.basic;
+
+import org.apache.airavata.security.AbstractDatabaseAuthenticator;
+import org.apache.airavata.security.AuthenticationException;
+import org.apache.airavata.services.registry.rest.security.session.DBLookup;
+import org.apache.commons.codec.binary.Base64;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.sql.SQLException;
+
+/**
+ * This authenticator handles basic access authentication requests. In basic access authentication
+ * we get user name and password as HTTP headers. The password is encoded with base64.
+ * More information @link{http://en.wikipedia.org/wiki/Basic_access_authentication}
+ */
+public class BasicAccessAuthenticator extends AbstractDatabaseAuthenticator {
+
+    private DBLookup dbLookup;
+
+    private String userTable;
+    private String userNameColumn;
+    private String passwordColumn;
+
+    private static final String AUTHENTICATOR_NAME = "BasicAccessAuthenticator";
+
+    /**
+     * Header names
+     */
+    private static final String AUTHORISATION_HEADER_NAME = "Authorization";
+    private static final String USER_IN_SESSION = "userName";
+
+    public BasicAccessAuthenticator() {
+        super(AUTHENTICATOR_NAME);
+    }
+
+    private String decode(String encoded) {
+        return new String(Base64.decodeBase64(encoded.getBytes()));
+    }
+
+    /**
+     * Returns user name and password as an array. The first element is user name and second is password.
+     *
+     * @param httpServletRequest The servlet request.
+     * @return User name password pair as an array.
+     * @throws AuthenticationException If an error occurred while extracting user name and password.
+     */
+    private String[] getUserNamePassword(HttpServletRequest httpServletRequest) throws AuthenticationException {
+
+        String basicHeader = httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME);
+
+        if (basicHeader == null) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String[] userNamePasswordArray = basicHeader.split(" ");
+
+        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String decodedString = decode(userNamePasswordArray[1]);
+
+        String[] array = decodedString.split(":");
+
+        if (array == null || array.length != 2) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        return array;
+
+    }
+
+    @Override
+    protected boolean doAuthentication(Object credentials) throws AuthenticationException {
+        if (this.dbLookup == null) {
+            throw new AuthenticationException("Authenticator is not initialized. Error processing request.");
+        }
+
+        if (credentials == null)
+            return false;
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        String[] array = getUserNamePassword(httpServletRequest);
+
+        String userName = array[0];
+        String password = array[1];
+
+        try {
+            String retrievedPassword = dbLookup.getMatchingColumnValue(userTable, passwordColumn, userNameColumn,
+                    userName);
+
+            return retrievedPassword != null && (retrievedPassword.equals(password));
+
+        } catch (SQLException e) {
+            throw new AuthenticationException("Error querying database for session information.", e);
+        }
+    }
+
+    protected void addUserToSession(String userName, HttpServletRequest servletRequest) {
+
+        if (servletRequest.getSession() != null) {
+            servletRequest.getSession().setAttribute(USER_IN_SESSION, userName);
+        }
+    }
+
+    @Override
+    public void onSuccessfulAuthentication(Object authenticationInfo) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
+
+        try {
+            String[] array = getUserNamePassword(httpServletRequest);
+
+            StringBuilder stringBuilder = new StringBuilder("User : ");
+
+            if (array != null) {
+
+                addUserToSession(array[0], httpServletRequest);
+
+                stringBuilder.append(array[0]).append(" successfully logged into system at ").append(getCurrentTime());
+                log.info(stringBuilder.toString());
+
+            } else {
+                log.error("System error occurred while extracting user name after authentication. " +
+                        "Couldn't extract user name from the request.");
+            }
+        } catch (AuthenticationException e) {
+            log.error("System error occurred while extracting user name after authentication.", e);
+        }
+
+    }
+
+    @Override
+    public void onFailedAuthentication(Object authenticationInfo) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
+
+        try {
+            String[] array = getUserNamePassword(httpServletRequest);
+
+            StringBuilder stringBuilder = new StringBuilder("User : ");
+
+            if (array != null) {
+
+                stringBuilder.append(array[0]).append(" Failed login attempt to system at ").append(getCurrentTime());
+                log.warn(stringBuilder.toString());
+
+            } else {
+                stringBuilder.append("Failed login attempt to system at ").append(getCurrentTime()).append( ". User unknown.");
+                log.warn(stringBuilder.toString());
+            }
+        } catch (AuthenticationException e) {
+            log.error("System error occurred while extracting user name after authentication.", e);
+        }
+    }
+
+    @Override
+    public boolean isAuthenticated(Object credentials) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        HttpSession httpSession = httpServletRequest.getSession();
+
+        return httpSession != null && httpSession.getAttribute(USER_IN_SESSION) != null;
+
+    }
+
+    @Override
+    public boolean canProcess(Object credentials) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        return (httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME) != null);
+    }
+
+    @Override
+    public void configure(Node node) throws RuntimeException {
+
+        super.configure(node);
+
+        /**
+         <specificConfigurations>
+         <database>
+         <jdbcUrl></jdbcUrl>
+         <databaseDriver></databaseDriver>
+         <userName></userName>
+         <password></password>
+         <userTableName></userTableName>
+         <userNameColumnName></userNameColumnName>
+         <passwordColumnName></passwordColumnName>
+         </database>
+         </specificConfigurations>
+         */
+
+        NodeList databaseNodeList = node.getChildNodes();
+
+        Node databaseNode = null;
+
+        for (int k = 0; k < databaseNodeList.getLength(); ++k) {
+
+            Node n = databaseNodeList.item(k);
+
+            if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
+                databaseNode = n;
+            }
+        }
+
+        if (databaseNode != null) {
+            NodeList nodeList = databaseNode.getChildNodes();
+
+            for (int i = 0; i < nodeList.getLength(); ++i) {
+                Node n = nodeList.item(i);
+
+                if (n.getNodeType() == Node.ELEMENT_NODE) {
+
+                    Element element = (Element) n;
+
+                    if (element.getNodeName().equals("userTableName")) {
+                        userTable = element.getFirstChild().getNodeValue();
+                    } else if (element.getNodeName().equals("userNameColumnName")) {
+                        userNameColumn = element.getFirstChild().getNodeValue();
+                    } else if (element.getNodeName().equals("passwordColumnName")) {
+                        passwordColumn = element.getFirstChild().getNodeValue();
+                    }
+                }
+            }
+        }
+
+        initializeDatabaseLookup();
+
+        StringBuilder stringBuilder = new StringBuilder("Configuring DB parameters for authenticator with User name Table - ");
+        stringBuilder.append(userTable).append(" User name column - ").append(userNameColumn).append(" Password column - ").
+                append(passwordColumn);
+
+        log.info(stringBuilder.toString());
+
+    }
+
+    private void initializeDatabaseLookup() throws RuntimeException {
+
+        this.dbLookup = new DBLookup(getDatabaseURL(), getDatabaseUserName(), getDatabasePassword(), getDatabaseDriver());
+
+        try {
+            this.dbLookup.init();
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("Error loading database driver. Driver class not found.", e);
+        } catch (InstantiationException e) {
+            throw new RuntimeException("Error loading database driver. Error instantiating driver object.", e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException("Error loading database driver. Illegal access to driver object.", e);
+        }
+    }
+
+    public String getUserTable() {
+        return userTable;
+    }
+
+    public String getUserNameColumn() {
+        return userNameColumn;
+    }
+
+    public String getPasswordColumn() {
+        return passwordColumn;
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/DBLookup.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/DBLookup.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/DBLookup.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/DBLookup.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,97 @@
+package org.apache.airavata.services.registry.rest.security.session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.sql.*;
+import java.util.Properties;
+
+/**
+ * Database lookup.
+ */
+public class DBLookup {
+
+    private String jdbcUrl;
+    private String databaseUserName;
+    private String databasePassword;
+    private String driverName;
+
+    protected static Logger log = LoggerFactory.getLogger(DBLookup.class);
+
+    private Properties properties;
+
+
+    public DBLookup(String jdbcUrl, String userName, String password, String driver) {
+
+        this.jdbcUrl = jdbcUrl;
+        this.databaseUserName = userName;
+        this.databasePassword = password;
+        this.driverName = driver;
+    }
+
+    public void init() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+        properties = new Properties();
+
+        properties.put("user", databaseUserName);
+        properties.put("password", databasePassword);
+        properties.put("characterEncoding", "ISO-8859-1");
+        properties.put("useUnicode", "true");
+
+        loadDriver();
+    }
+
+    public String getMatchingColumnValue(String tableName, String selectColumn, String whereValue)
+            throws SQLException {
+        return getMatchingColumnValue(tableName, selectColumn, selectColumn, whereValue);
+    }
+
+    public String getMatchingColumnValue(String tableName, String selectColumn, String whereColumn, String whereValue)
+            throws SQLException {
+
+        StringBuilder stringBuilder = new StringBuilder();
+
+        stringBuilder.append("SELECT ").append(selectColumn).append(" FROM ").append(tableName)
+                .append(" WHERE ").append(whereColumn).append(" = ?");
+
+        String sql = stringBuilder.toString();
+
+        Connection connection = getConnection();
+
+        PreparedStatement ps = connection.prepareStatement(sql);
+        ResultSet rs = null;
+
+        try {
+            ps.setString(1, whereValue);
+            rs = ps.executeQuery();
+
+            if (rs.next()) {
+                return rs.getString(1);
+            }
+
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+
+                ps.close();
+                connection.close();
+
+            } catch (Exception ignore) {
+                log.error("An error occurred while closing database connections ", ignore);
+            }
+        }
+
+        return null;
+    }
+
+    private void loadDriver() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        Class.forName(driverName).newInstance();
+    }
+
+    private Connection getConnection() throws SQLException {
+        return DriverManager.getConnection(jdbcUrl, properties);
+    }
+
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,202 @@
+package org.apache.airavata.services.registry.rest.security.session;
+
+import org.apache.airavata.security.AbstractDatabaseAuthenticator;
+import org.apache.airavata.security.AuthenticationException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.sql.SQLException;
+
+/**
+ * This authenticator will authenticate requests based on a session (NOT HTTP Session) id stored
+ * in the database.
+ */
+public class SessionAuthenticator extends AbstractDatabaseAuthenticator {
+
+    private DBLookup dbLookup;
+
+    private String sessionTable;
+    private String sessionColumn;
+    private String comparingColumn;
+
+    private static final String AUTHENTICATOR_NAME = "SessionAuthenticator";
+
+    private static final String SESSION_TICKET = "sessionTicket";
+
+    public SessionAuthenticator() {
+        super(AUTHENTICATOR_NAME);
+    }
+
+    @Override
+    public boolean doAuthentication(Object credentials) throws AuthenticationException {
+
+        if (this.dbLookup == null) {
+            throw new AuthenticationException("Authenticator is not initialized. Error processing request.");
+        }
+
+        if (credentials == null)
+            return false;
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest)credentials;
+        String sessionTicket = httpServletRequest.getHeader(SESSION_TICKET);
+        try {
+            String sessionString = dbLookup.getMatchingColumnValue(sessionTable, sessionColumn, sessionTicket);
+            return (sessionString != null);
+        } catch (SQLException e) {
+            throw new AuthenticationException("Error querying database for session information.", e);
+        }
+    }
+
+    @Override
+    public boolean canProcess(Object credentials) {
+
+        if (credentials instanceof HttpServletRequest) {
+            HttpServletRequest request = (HttpServletRequest) credentials;
+
+            String ticket = request.getHeader(SESSION_TICKET);
+            if (ticket != null) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Override
+    public void onSuccessfulAuthentication(Object authenticationInfo) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest)authenticationInfo;
+        String sessionTicket = httpServletRequest.getHeader(SESSION_TICKET);
+
+        // Add sessionTicket to http session
+        HttpSession httpSession = httpServletRequest.getSession();
+
+        if (httpSession != null) {
+            httpSession.setAttribute(SESSION_TICKET, sessionTicket);
+        }
+
+        log.info("A request with a session ticket is successfully logged in.");
+
+    }
+
+    @Override
+    public void onFailedAuthentication(Object authenticationInfo) {
+        log.warn("Failed attempt to login.");
+    }
+
+    @Override
+    public void configure(Node node) throws RuntimeException {
+
+        super.configure(node);
+
+        /**
+         <specificConfigurations>
+         <database>
+         <jdbcUrl></jdbcUrl>
+         <databaseDriver></databaseDriver>
+         <userName></userName>
+         <password></password>
+         </database>
+         </specificConfigurations>
+         */
+
+        NodeList databaseNodeList = node.getChildNodes();
+
+        Node databaseNode = null;
+
+        for (int k = 0; k < databaseNodeList.getLength(); ++k) {
+
+            Node n = databaseNodeList.item(k);
+
+            if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
+                databaseNode = n;
+            }
+        }
+
+        if (databaseNode != null) {
+            NodeList nodeList = databaseNode.getChildNodes();
+
+            for (int i = 0; i < nodeList.getLength(); ++i) {
+                Node n = nodeList.item(i);
+
+                if (n.getNodeType() == Node.ELEMENT_NODE) {
+
+                    Element element = (Element) n;
+
+                    if (element.getNodeName().equals("sessionTable")) {
+                        sessionTable = element.getFirstChild().getNodeValue();
+                    } else if (element.getNodeName().equals("sessionColumn")) {
+                        sessionColumn = element.getFirstChild().getNodeValue();
+                    } else if (element.getNodeName().equals("comparingColumn")) {
+                        comparingColumn = element.getFirstChild().getNodeValue();
+                    }
+                }
+            }
+        }
+
+        initializeDatabaseLookup();
+
+        StringBuilder stringBuilder = new StringBuilder("Configuring DB parameters for authenticator with Session Table - ");
+        stringBuilder.append(sessionTable).append(" Session column - ").append(sessionColumn).append(" Comparing column - ").
+                append(comparingColumn);
+
+        log.info(stringBuilder.toString());
+
+    }
+
+    private void initializeDatabaseLookup() throws RuntimeException {
+
+        this.dbLookup = new DBLookup(getDatabaseURL(), getDatabaseUserName(), getDatabasePassword(), getDatabaseDriver());
+
+        try {
+            this.dbLookup.init();
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("Error loading database driver. Driver class not found.", e);
+        } catch (InstantiationException e) {
+            throw new RuntimeException("Error loading database driver. Error instantiating driver object.", e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException("Error loading database driver. Illegal access to driver object.", e);
+        }
+    }
+
+    public String getSessionTable() {
+        return sessionTable;
+    }
+
+    public void setSessionTable(String sessionTable) {
+        this.sessionTable = sessionTable;
+    }
+
+    public String getSessionColumn() {
+        return sessionColumn;
+    }
+
+    public void setSessionColumn(String sessionColumn) {
+        this.sessionColumn = sessionColumn;
+    }
+
+    public String getComparingColumn() {
+        return comparingColumn;
+    }
+
+    public void setComparingColumn(String comparingColumn) {
+        this.comparingColumn = comparingColumn;
+    }
+
+
+    @Override
+    public boolean isAuthenticated(Object credentials) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest)credentials;
+
+        if (httpServletRequest.getSession() != null) {
+            String sessionTicket = (String)httpServletRequest.getSession().getAttribute(SESSION_TICKET);
+            return (sessionTicket != null);
+        }
+
+        return false;
+
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,57 @@
+package org.apache.airavata.services.registry.rest.utils;
+
+import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.Axis2Registry;
+import org.apache.airavata.registry.api.DataRegistry;
+import org.apache.airavata.registry.api.impl.AiravataJCRRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.net.URI;
+import java.util.HashMap;
+
+public class RegistryListener implements ServletContextListener {
+
+    private static AiravataRegistry airavataRegistry;
+    private static Axis2Registry axis2Registry;
+    private static DataRegistry dataRegistry;
+
+
+    protected static Logger log = LoggerFactory.getLogger(RegistryListener.class);
+
+
+    public void contextInitialized(ServletContextEvent servletContextEvent) {
+        try {
+            ServletContext servletContext = servletContextEvent.getServletContext();
+            URI url = new URI("http://localhost:8081/rmi");
+            String username = "admin";
+            String password = "admin";
+            HashMap<String, String> map = new HashMap<String, String>();
+            map.put("org.apache.jackrabbit.repository.uri", url.toString());
+
+
+            airavataRegistry = new AiravataJCRRegistry(url,
+                    "org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory", username, password, map);
+
+            axis2Registry = new AiravataJCRRegistry(url,
+                    "org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory", username, password, map);
+
+            dataRegistry = new AiravataJCRRegistry(url,
+                    "org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory", username, password, map);
+
+            servletContext.setAttribute("airavataRegistry", airavataRegistry);
+            servletContext.setAttribute("axis2Registry", axis2Registry);
+            servletContext.setAttribute("dataRegistry", dataRegistry);
+        } catch (Exception e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+
+    public void contextDestroyed(ServletContextEvent servletContextEvent) {
+
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/ServiceMessage.xsd
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/ServiceMessage.xsd?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/ServiceMessage.xsd (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/ServiceMessage.xsd Thu Sep 13 20:03:46 2012
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="Message">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="Header"/>
+        <xs:element ref="Body"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="Header">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="experimentid" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="hostname" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="processorcount" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="hostcount" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="queuename" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="walltime" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="gfaclocation" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="user" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="messengerURL" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="serviceName" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="workflowName" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="experimentid" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Host name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="hostname" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Host name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="processorcount" type="xs:int">
+    <xs:annotation>
+      <xs:documentation>Process Count</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="hostcount" type="xs:int">
+    <xs:annotation>
+      <xs:documentation>Process Count</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="queuename" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Queue Name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="walltime" type="xs:int">
+    <xs:annotation>
+      <xs:documentation>Walltime</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="gfaclocation" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Gfac location</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="user" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>User information</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="messengerURL" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Messenger URL information</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="serviceName" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Service Name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="workflowName" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Workflow Name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="Body">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="inputs" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="inputs">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="input" minOccurs="0"  maxOccurs="unbounded"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="input">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="param" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="value" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="type" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+   <xs:element name="name" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Input Name</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="param" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Input Params</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="value" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Input Value</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="type" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Input Type</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="MessageResponse">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="experimentid" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="status" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="message" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="inputs" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="outputs" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="stdout" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="stderr" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="status" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Status</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="message" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>Message</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+   <xs:element name="outputs">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="output" minOccurs="0"  maxOccurs="unbounded"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="output">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="value" minOccurs="0" maxOccurs="1"/>
+        <xs:element ref="type" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="stdout" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>stdout </xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="stderr" type="xs:string">
+    <xs:annotation>
+      <xs:documentation>stderr</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+</xs:schema>

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/authenticators.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/authenticators.xml?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/authenticators.xml (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/authenticators.xml Thu Sep 13 20:03:46 2012
@@ -0,0 +1,42 @@
+<?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 &lt;specificConfigurations&gt; tags.
+-->
+
+<authenticators>
+    <authenticator name="sessionAuthenticator" class="org.apache.airavata.services.registry.rest.security.session.SessionAuthenticator" enabled="true" priority="6">
+        <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>
+                <userName>sa</userName>
+                <password>sa</password>
+                <databaseDriver>org.h2.Driver</databaseDriver>
+                <sessionTable>Persons</sessionTable>
+                <sessionColumn>sessionId</sessionColumn>
+                <comparingColumn>sessionId</comparingColumn>
+            </database>
+        </specificConfigurations>
+    </authenticator>
+
+    <authenticator name="basicAccessAuthenticator" class="org.apache.airavata.services.registry.rest.security.basic.BasicAccessAuthenticator" enabled="true" priority="7">
+        <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>
\ No newline at end of file

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/log4j.xml?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/log4j.xml (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/log4j.xml Thu Sep 13 20:03:46 2012
@@ -0,0 +1,49 @@
+<?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.
+
+  $Id$
+-->
+<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <!-- Appenders -->
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%-5p: %c - %m%n" />
+    </layout>
+  </appender>
+
+  <!-- Jersey logger -->
+  <logger name="com.sun.jersey">
+    <level value="info" />
+  </logger>
+
+  <!-- Airavata logger -->
+  <logger name="org.apache.airavata">
+    <level value="info" />
+  </logger>
+
+  <!-- Root Logger -->
+  <root>
+    <priority value="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
\ No newline at end of file

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/service.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/service.properties?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/service.properties (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/resources/service.properties Thu Sep 13 20:03:46 2012
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+jcr.username=admin
+jcr.password=admin
+jcr.url=http://localhost:8081/rmi

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/WEB-INF/web.xml?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/WEB-INF/web.xml Thu Sep 13 20:03:46 2012
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This web.xml file is not required when using Servlet 3.0 container,
+     see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e194 -->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <listener>
+      <listener-class>org.apache.airavata.services.registry.rest.utils.RegistryListener</listener-class>
+    </listener>
+     <!--context-param>
+      <param-name>authenticatorConfigurations</param-name>
+      <param-value>/WEB-INF/classes/authenticator.configurations.xml</param-value>
+    </context-param -->
+
+    <filter>
+        <filter-name>AuthenticationFilter</filter-name>
+        <filter-class>org.apache.airavata.services.registry.rest.security.HttpAuthenticatorFilter</filter-class>
+        <init-param>
+            <param-name>authenticatorConfigurations</param-name>
+            <param-value>authenticators.xml</param-value>
+        </init-param>
+    </filter>
+
+    <servlet>
+        <servlet-name>Airavata Web Application</servlet-name>
+        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.config.property.packages</param-name>
+            <param-value>org.apache.airavata.services.registry.rest</param-value>
+        </init-param>
+        <!--init-param>
+            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
+            <param-value>org.apache.airavata.services.registry.rest.security.JerseyAuthenticatorFilter</param-value>
+        </init-param -->
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Airavata Web Application</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+    <filter-mapping>
+        <filter-name>AuthenticationFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+</web-app>

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/index.jsp?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/index.jsp (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/main/webapp/index.jsp Thu Sep 13 20:03:46 2012
@@ -0,0 +1,8 @@
+<html>
+<body>
+<h2>Jersey RESTful Web Application!</h2>
+<p><a href="webresources/myresource">Jersey resource</a>
+<p>Visit the <a href="http://jersey.java.net">Project Jersey website</a>
+for more information on Jersey!
+</body>
+</html>

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,52 @@
+package org.apache.airavata.services.registry.rest.security;
+
+import junit.framework.TestCase;
+import org.apache.airavata.security.Authenticator;
+import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
+
+import java.util.List;
+
+/**
+ * An abstract class to implement test cases for authenticators.
+ */
+public abstract class AbstractAuthenticatorTest extends TestCase {
+
+    private String authenticatorName;
+
+    protected Authenticator authenticator = null;
+
+    public AbstractAuthenticatorTest(String name) throws Exception {
+        authenticatorName = name;
+    }
+
+    protected AuthenticatorConfigurationReader authenticatorConfigurationReader;
+
+    public void setUp() throws Exception {
+
+        authenticatorConfigurationReader = new AuthenticatorConfigurationReader();
+        authenticatorConfigurationReader.init(this.getClass().getClassLoader().getResourceAsStream("authenticators.xml"));
+
+        List<Authenticator> listAuthenticators = authenticatorConfigurationReader.getAuthenticatorList();
+
+        if (listAuthenticators == null) {
+            throw new Exception("No authenticators found !");
+        }
+
+        for (Authenticator a : listAuthenticators) {
+            if (a.getAuthenticatorName().equals(authenticatorName)) {
+                authenticator = a;
+            }
+        }
+
+        if (authenticator == null) {
+            throw new Exception("Could not find an authenticator with name " + authenticatorName);
+        }
+
+    }
+
+    public abstract void testAuthenticateSuccess() throws Exception;
+
+    public abstract void testAuthenticateFail() throws Exception;
+
+    public abstract void testCanProcess() throws Exception;
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/MyHttpServletRequest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/MyHttpServletRequest.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/MyHttpServletRequest.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/MyHttpServletRequest.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,351 @@
+package org.apache.airavata.services.registry.rest.security;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.*;
+
+/**
+ * Test servlet implementation. For test cases only.
+ */
+public class MyHttpServletRequest implements HttpServletRequest {
+
+    private Map<String, String> headers = new HashMap<String, String>();
+
+    public void addHeader(String name, String value) {
+        headers.put(name, value);
+    }
+
+    @Override
+    public String getAuthType() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Cookie[] getCookies() {
+        return new Cookie[0];  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public long getDateHeader(String s) {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getHeader(String s) {
+        return headers.get(s);
+    }
+
+    @Override
+    public Enumeration<String> getHeaders(String s) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Enumeration<String> getHeaderNames() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getIntHeader(String s) {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getMethod() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getPathInfo() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getPathTranslated() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getContextPath() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getQueryString() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRemoteUser() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isUserInRole(String s) {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Principal getUserPrincipal() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRequestedSessionId() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRequestURI() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public StringBuffer getRequestURL() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getServletPath() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public HttpSession getSession(boolean b) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public HttpSession getSession() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isRequestedSessionIdValid() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromCookie() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromURL() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromUrl() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void login(String s, String s1) throws ServletException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void logout() throws ServletException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Collection<Part> getParts() throws IOException, ServletException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Part getPart(String s) throws IOException, ServletException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Object getAttribute(String s) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Enumeration<String> getAttributeNames() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getCharacterEncoding() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getContentLength() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getContentType() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public ServletInputStream getInputStream() throws IOException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getParameter(String s) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Enumeration<String> getParameterNames() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String[] getParameterValues(String s) {
+        return new String[0];  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Map<String, String[]> getParameterMap() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getProtocol() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getScheme() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getServerName() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getServerPort() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public BufferedReader getReader() throws IOException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRemoteAddr() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRemoteHost() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setAttribute(String s, Object o) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void removeAttribute(String s) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Locale getLocale() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Enumeration<Locale> getLocales() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isSecure() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public RequestDispatcher getRequestDispatcher(String s) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getRealPath(String s) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getRemotePort() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getLocalName() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getLocalAddr() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getLocalPort() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public ServletContext getServletContext() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public AsyncContext startAsync() throws IllegalStateException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isAsyncStarted() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public boolean isAsyncSupported() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public AsyncContext getAsyncContext() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public DispatcherType getDispatcherType() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticatorTest.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticatorTest.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticatorTest.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,68 @@
+package org.apache.airavata.services.registry.rest.security.basic;
+
+import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
+import org.apache.airavata.services.registry.rest.security.AbstractAuthenticatorTest;
+import org.apache.airavata.services.registry.rest.security.MyHttpServletRequest;
+import org.apache.airavata.services.registry.rest.security.session.SessionAuthenticator;
+import org.apache.commons.codec.binary.Base64;
+
+/**
+ * Test class for basic access authenticator.
+ */
+public class BasicAccessAuthenticatorTest extends AbstractAuthenticatorTest {
+
+    private SessionAuthenticator sessionAuthenticator;
+
+    private AuthenticatorConfigurationReader authenticatorConfigurationReader;
+
+    public BasicAccessAuthenticatorTest() throws Exception {
+        super("basicAccessAuthenticator");
+    }
+
+
+    @Override
+    public void testAuthenticateSuccess() throws Exception {
+
+        assertTrue(authenticator.authenticate(getRequest("amilaj:secret")));
+    }
+
+    @Override
+     public void testAuthenticateFail() throws Exception {
+        assertFalse(authenticator.authenticate(getRequest("amilaj:secret1")));
+    }
+
+    public void testAuthenticateFailUserName() throws Exception {
+        assertFalse(authenticator.authenticate(getRequest("amila:secret1")));
+    }
+
+    @Override
+    public void testCanProcess() throws Exception {
+
+        assertTrue(authenticator.canProcess(getRequest("amilaj:secret")));
+    }
+
+    private MyHttpServletRequest getRequest(String userPassword) {
+        MyHttpServletRequest myHttpServletRequest = new MyHttpServletRequest();
+
+        String authHeader = "Basic " + new String(Base64.encodeBase64(userPassword.getBytes()));
+
+        myHttpServletRequest.addHeader("Authorization", authHeader);
+
+        return myHttpServletRequest;
+
+    }
+
+    public void tearDown() throws Exception {
+
+    }
+
+    public void testConfigure() throws Exception {
+
+        BasicAccessAuthenticator basicAccessAuthenticator = (BasicAccessAuthenticator)authenticator;
+
+        assertEquals("AIRAVATA_USER", basicAccessAuthenticator.getUserTable());
+        assertEquals("USERID", basicAccessAuthenticator.getUserNameColumn());
+        assertEquals("PASSWORD", basicAccessAuthenticator.getPasswordColumn());
+    }
+
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/DBLookupTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/DBLookupTest.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/DBLookupTest.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/DBLookupTest.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,46 @@
+package org.apache.airavata.services.registry.rest.security.session;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * Test class for DBSession lookup.
+ */
+public class DBLookupTest extends TestCase {
+
+    private DBLookup dbLookup;
+
+    private String url = "jdbc:h2:src/test/resources/testdb/test";
+    //private String url = "jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test";
+    private String userName = "sa";
+    private String password = "sa";
+    private String driver = "org.h2.Driver";
+
+    private String sessionTable = "Persons";
+    private String sessionColumn = "sessionId";
+
+    public void setUp() throws Exception {
+        File f = new File(".");
+        System.out.println(f.getAbsolutePath());
+        dbLookup = new DBLookup(url, userName, password, driver);
+        dbLookup.init();
+
+    }
+
+    public void tearDown() throws Exception {
+
+    }
+
+    public void testGetSessionString() throws Exception {
+
+        String sessionId = dbLookup.getMatchingColumnValue(sessionTable, sessionColumn, "1234");
+        assertNotNull(sessionId);
+    }
+
+    public void testGetSessionStringInvalidSession() throws Exception {
+        String sessionId = dbLookup.getMatchingColumnValue(sessionTable, sessionColumn, "12345");
+        assertNull(sessionId);
+    }
+}
+

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticatorTest.java?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticatorTest.java (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticatorTest.java Thu Sep 13 20:03:46 2012
@@ -0,0 +1,50 @@
+package org.apache.airavata.services.registry.rest.security.session;
+
+import org.apache.airavata.services.registry.rest.security.AbstractAuthenticatorTest;
+import org.apache.airavata.services.registry.rest.security.MyHttpServletRequest;
+
+/**
+ * Session authenticator test.
+ */
+public class SessionAuthenticatorTest extends AbstractAuthenticatorTest {
+
+    public SessionAuthenticatorTest() throws Exception {
+        super("sessionAuthenticator");
+    }
+
+    public void testAuthenticateSuccess() throws Exception {
+
+        MyHttpServletRequest servletRequestRequest = new MyHttpServletRequest();
+        servletRequestRequest.addHeader("sessionTicket", "1234");
+
+        assertTrue(authenticator.authenticate(servletRequestRequest));
+
+    }
+
+    public void testAuthenticateFail() throws Exception {
+
+        MyHttpServletRequest servletRequestRequest = new MyHttpServletRequest();
+        servletRequestRequest.addHeader("sessionTicket", "12345");
+
+        assertFalse(authenticator.authenticate(servletRequestRequest));
+
+    }
+
+    public void testCanProcess() throws Exception {
+
+        MyHttpServletRequest servletRequestRequest = new MyHttpServletRequest();
+        servletRequestRequest.addHeader("sessionTicket", "12345");
+
+        assertTrue(authenticator.canProcess(servletRequestRequest));
+
+    }
+
+    public void testConfigure() throws Exception {
+
+        SessionAuthenticator sessionAuthenticator = (SessionAuthenticator)authenticator;
+
+        assertEquals("Persons", sessionAuthenticator.getSessionTable());
+        assertEquals("sessionId", sessionAuthenticator.getSessionColumn());
+        assertEquals("sessionId", sessionAuthenticator.getComparingColumn());
+    }
+}

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/authenticators.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/authenticators.xml?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/authenticators.xml (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/authenticators.xml Thu Sep 13 20:03:46 2012
@@ -0,0 +1,41 @@
+<?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 &lt;specificConfigurations&gt; tags.
+-->
+
+<authenticators>
+    <authenticator name="sessionAuthenticator" class="org.apache.airavata.services.registry.rest.security.session.SessionAuthenticator" enabled="true" priority="6">
+        <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>
+                <sessionTable>Persons</sessionTable>
+                <sessionColumn>sessionId</sessionColumn>
+                <comparingColumn>sessionId</comparingColumn>
+            </database>
+        </specificConfigurations>
+    </authenticator>
+
+    <authenticator name="basicAccessAuthenticator" class="org.apache.airavata.services.registry.rest.security.basic.BasicAccessAuthenticator" enabled="true" priority="7">
+        <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>
\ No newline at end of file

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/service.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/service.properties?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/service.properties (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/service.properties Thu Sep 13 20:03:46 2012
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+jcr.username=admin
+jcr.password=admin
+jcr.url=http://localhost:8081/rmi

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.h2.db
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.h2.db?rev=1384499&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.h2.db
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.trace.db
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.trace.db?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.trace.db (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test.trace.db Thu Sep 13 20:03:46 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: incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test/test.trace.db
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test/test.trace.db?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test/test.trace.db (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/airavata-registry-rest/src/test/resources/testdb/test/test.trace.db Thu Sep 13 20:03:46 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]

Added: incubator/airavata/sandbox/airavata-rest-security/modules/commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/sandbox/airavata-rest-security/modules/commons/pom.xml?rev=1384499&view=auto
==============================================================================
--- incubator/airavata/sandbox/airavata-rest-security/modules/commons/pom.xml (added)
+++ incubator/airavata/sandbox/airavata-rest-security/modules/commons/pom.xml Thu Sep 13 20:03:46 2012
@@ -0,0 +1,40 @@
+<?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/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.5-incubating-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>commons</artifactId>
+    <packaging>pom</packaging>
+    <name>Airavata Commons</name>
+    <url>http://www.airavata.org</url>
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <modules>
+                <module>airavata-registry-rest</module>
+            </modules>
+        </profile>
+    </profiles>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+</project>



Mime
View raw message