http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp deleted file mode 100644 index 94bc6d9..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %> -<%-- - Created by IntelliJ IDEA. - User: thejaka - Date: 8/5/13 - Time: 4:48 PM - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%-- - ~ 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. - --%> - - -<html> -<body> - -<table width="100%" border="0"> - <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr> -</table> - -<h2>Sample Gateway</h2> - - - -<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p> -<form name="input" action="https://localhost:8443/airavata/acs-start-servlet" method="post"> - - <table border="0"> - <tr> - <td>Gateway Name</td> - <td><input type="text" name="gatewayName" value="default" readonly="readonly"></td> - </tr> - <tr> - <td>Portal Username</td> - <td><input type="text" name="portalUserName"></td> - </tr> - <tr> - <td>Contact Email</td> - <td><input type="text" name="email"></td> - </tr> - </table> - - <input type="submit" value="Submit"> -</form> -</body> -</html>
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp deleted file mode 100644 index 560f64f..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %> -<%-- - Created by IntelliJ IDEA. - User: thejaka - Date: 8/5/13 - Time: 4:48 PM - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%-- - ~ 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. - --%> - -<% - SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION); - - boolean success = false; - - String tokenId = request.getParameter("tokenId"); - - if (tokenId != null) { - sampleGateway.updateTokenId(tokenId); - success = true; - } -%> - -<html> -<body> - -<table width="100%" border="0"> - <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr> -</table> - -<h2>Sample Gateway</h2> -<% - out.println("The received token id - "); - out.println(tokenId); - - if (success) { -%> -<p>Token id successfully updated.</p> - -<p> - View users who obtained token id. -<ol> - <li><a href="list_users.jsp">List Users</a></li> -</ol> -</p> - -<% - } else { - -%> -<p> Error updating token id.</p> -<% - - } - -%> - - -</body> -</html> http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp deleted file mode 100644 index 36883b7..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --%> - -<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %> -<%@ page import="java.util.List" %> -<%@ page import="org.apache.airavata.sample.gateway.userstore.User" %> -<%-- - Created by IntelliJ IDEA. - User: thejaka - Date: 8/5/13 - Time: 12:30 PM - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION); -%> - -<html> -<head> - <title>List Users</title> -</head> -<body> - -<table width="100%" border="0"> - <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr> -</table> - -<h1>Sample Gateway</h1> - - -<p> This page lists all users and their attributes. </p> - -<table> - <tr> - <td>UserName</td> - <td>E-Mail</td> - <td>TokenId</td> - </tr> -<% - List<User> userList = sampleGateway.getAllUsers(); - for (User u : userList) { -%> - <tr> - <td> - <%=u.getUserName() %> - </td> - <td> - <%=u.getEmail() %> - </td> - <td> - <%=u.getToken() %> - </td> - - </tr> - <% - } - %> -</table> - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp deleted file mode 100644 index 63d90be..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --%> -<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %><% - session.removeAttribute("userName"); - session.removeAttribute(SampleGateway.GATEWAY_SESSION); - session.invalidate(); -%> - -<html> -<head> - <script language=javascript> - function redirect(){ - window.location = "../index.jsp"; - } - </script> -</head> -<body onload="redirect()"> -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp deleted file mode 100644 index 1fd1957..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp +++ /dev/null @@ -1,102 +0,0 @@ -<%-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --%> - -<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %> -<%-- - Created by IntelliJ IDEA. - User: thejaka - Date: 7/31/13 - Time: 5:08 PM - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - String loginScreen = request.getParameter("loginScreen"); - - String user = (String)session.getAttribute("userName"); - boolean authenticate = false; - - if (loginScreen != null && loginScreen.equals("true")) { - SampleGateway sampleGateway = null; - sampleGateway = (SampleGateway) session.getAttribute(SampleGateway.GATEWAY_SESSION); - - if (sampleGateway == null) { - sampleGateway = new SampleGateway(session.getServletContext()); - } - - session.setAttribute(SampleGateway.GATEWAY_SESSION, sampleGateway); - - user = request.getParameter("username"); - String password = request.getParameter("password"); - - authenticate = sampleGateway.authenticate(user, password); - } else { - authenticate = true; - } - -%> -<html> - -<head> - <title>Manage</title> -</head> -<body> - -<table width="100%" border="0"> - <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr> -</table> - -<h1>Sample Gateway</h1> - -<% - if (authenticate) { - - session.setAttribute("userName", user); - - if (SampleGateway.isAdmin(user)) { -%> -<h1>Administration</h1> -<p> - This page allows administration functionality. -<ol> - <li><a href="acs.jsp">Retrieve Credentials</a></li> - <li><a href="list_users.jsp">List Users</a></li> -</ol> -</p> - - -<% - } else { -%> - -<p> You are a normal user. Click <a href="job.jsp">here</a> to configure and run "Echo" workflow on a GRID machine.</p> - -<% - } - } else { -%> - -<h1>Authentication failed</h1> - -<% - } -%> - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png b/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png deleted file mode 100644 index 4baf51b..0000000 Binary files a/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp deleted file mode 100644 index 1bf0ed6..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---%> - -<html> -<body> -<img src="images/airavata-logo-2.png"> -<h2>Airavata Credential Store</h2> -<p>Welcome to Airavata Credential Store Web Application</p> - -<p><a href="user-store/add.jsp"><b>Manage Local User Store</b></a></p> -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp deleted file mode 100644 index f37684d..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp +++ /dev/null @@ -1,142 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---%> -<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %> - -<html> - -<head> - <script language="javascript" type="text/javascript"> - function validatePassword(fld1name, regString) { - var stringValue = document.getElementsByName(fld1name)[0].value; - var errorMessage = ""; - if(regString != "null" && !stringValue.match(new RegExp(regString))){ - errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " + - "characters."; - return errorMessage; - }else if(regString != "null" && stringValue == ''){ - return errorMessage; - } - - if (stringValue == '') { - errorMessage = "Empty passwords are not allowed. Please enter a valid password"; - return errorMessage; - } - - return errorMessage; - } - - function validateUsername(fld1name) { - var stringValue = document.getElementsByName(fld1name)[0].value; - var errorMessage = ""; - - if (stringValue == '') { - errorMessage = "Empty user names are not allowed. Please enter a valid user name."; - return errorMessage; - } - - return errorMessage; - } - - function checkPasswordsMatching(fld1name, fld2name) { - - var stringValue1 = document.getElementsByName(fld1name)[0].value; - var stringValue2 = document.getElementsByName(fld2name)[0].value; - var errorMessage = ""; - - if (stringValue1 != stringValue2) { - errorMessage = "Confirm password does not match with the password. Please re-enter passwords."; - return errorMessage; - } - - return errorMessage; - - } - - function validate() { - var reason = ""; - - reason = validateUsername("username"); - - if (reason != "") { - alert(reason); - return false; - } - - reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>); - - if (reason != "") { - alert(reason); - document.getElementsByName("newPassword")[0].clear(); - return false; - } - - reason = checkPasswordsMatching("newPassword", "confirmPassword"); - - if (reason != "") { - alert(reason); - document.getElementsByName("newPassword")[0].clear(); - document.getElementsByName("confirmPassword")[0].clear(); - return false; - } - - return true; - } - - function doProcess() { - if (validate() == true) { - document.registration.submit(); - } - } - - - </script> -</head> - -<body> -<img src="../images/airavata-logo-2.png"> -<h2>Airavata Credential Store - Local User Store</h2> -<p><b>Manage Local User Store - Add New User</b></p> - -<form action="index.jsp" name="registration" method="POST"> - - <input type="hidden" name="operation" value="addUser"> - <table> - <tr> - <td>User Name</td> - <td><input type="text" name="username" maxlength="150"></td> - </tr> - <tr> - <td>Password</td> - <td><input type="password" name="newPassword"/></td> - </tr> - <tr> - <td>Re-Type Password</td> - <td><input type="password" name="confirmPassword"/></td> - </tr> - </table> - - <table> - <tr> - <td><input type="button" value="Add" onclick= 'doProcess()'></td> - <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td> - </tr> - </table> - -</form> - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp deleted file mode 100644 index 732c0c7..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp +++ /dev/null @@ -1,138 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---%> - -<%@ page import = "org.apache.airavata.credentialstore.local.LocalUserStore" %> -<%@ page import="org.apache.airavata.credentialstore.basic.BasicAccessAuthenticator" %> -<%@ page import="org.apache.airavata.credentialstore.session.HttpAuthenticatorFilter" %> -<%@ page import="java.util.List" %> -<%@ page import="org.apache.airavata.common.utils.Constants" %> -<% - - LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore"); - - if (localUserStore == null) { - - String operatingUser = (String) session.getAttribute(Constants.USER_IN_SESSION); - - if (operatingUser == null || !operatingUser.equals("admin")) { - HttpAuthenticatorFilter.sendUnauthorisedError(response, "Insufficient privileges to perform user operations." + - " Only admin user is allowed to perform user operations."); - - return; - } - - localUserStore = new LocalUserStore(application); - - session.setAttribute("LocalUserStore", localUserStore); - } - - String operation = request.getParameter("operation"); - if (operation != null) { - if (operation.equals("addUser")) { - String userName = request.getParameter("username"); - String password = request.getParameter("newPassword"); - - localUserStore.addUser(userName, password); - } else if (operation.equals("deleteUser")) { - String[] usersToDelete = request.getParameterValues("user-id"); - - for (String deleteUser : usersToDelete) { - localUserStore.deleteUser(deleteUser); - } - } - } - - List<String> allUsers = localUserStore.getUsers(); - -%> - -<html> -<head> - <script language="javascript" type="text/javascript"> - - function validate() { - var checkSelected = false; - for (var i = 0; i < <%=allUsers.size()%>; i++) { - if (document.main["user-id"][i].checked) { - checkSelected = true; - } - } - if (checkSelected) { - var answer = confirm("Are you sure you want to delete selected users from the system ?"); - if (answer) { - return true; - } - } else { - alert("Select at least one user to delete."); - } - return false; - } - - function doProcess() { - if (validate() == true) { - document.main.submit(); - } - } - - </script> -</head> -<body> -<img src="../images/airavata-logo-2.png"> -<h2>Airavata REST API - Local User Store</h2> -<p><b>Manage Local User Store</b></p> - - -<form action="index.jsp" name="main" method="POST"> - <table> - <tr> - <td> </td> - <td>All Users</td> - </tr> - <% - for (String user : allUsers) { - %> - - <tr> - <td><input type="checkbox" name="user-id" value="<%=user%>"></td> - <td><%=user%> - </td> - <td><a href="password.jsp?username=<%=user%>">Change Password</a></td> - </tr> - - <% - } - %> - </table> - - <br> - - <table width="100"> - <tr> - <td> - <a href="add.jsp"><input type="button" value="Add" name="Add"/></a> - </td> - <td> </td> - <input type="hidden" name="operation" value="deleteUser"> - <td><input type="button" value="Delete" onclick="doProcess()"></td> - </tr> - </table> - -</form> - - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp deleted file mode 100644 index 9a316ee..0000000 --- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp +++ /dev/null @@ -1,157 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---%> - -<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %> - -<% - String userName = request.getParameter("username"); - if (userName == null) { - response.sendRedirect("index.jsp"); - } - - String password = request.getParameter("newPassword"); - String confirmPassword = request.getParameter("confirmPassword"); - - if (password != null && confirmPassword != null && password.equals(confirmPassword)) { - LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore"); - localUserStore.changePasswordByAdmin(userName, password); - - response.sendRedirect("password.jsp?message=\"Password successfully change for user " - + userName + "\"&username=" + userName); - } - -%> - -<html> -<head> - <script language="javascript" type="text/javascript"> - function validatePassword(fld1name, regString) { - var stringValue = document.getElementsByName(fld1name)[0].value; - var errorMessage = ""; - if(regString != "null" && !stringValue.match(new RegExp(regString))){ - errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " + - "characters."; - return errorMessage; - }else if(regString != "null" && stringValue == ''){ - return errorMessage; - } - - if (stringValue == '') { - errorMessage = "Empty passwords are not allowed. Please enter a valid password"; - return errorMessage; - } - - return errorMessage; - } - - function validateUsername(fld1name) { - var stringValue = document.getElementsByName(fld1name)[0].value; - var errorMessage = ""; - - if (stringValue == '') { - errorMessage = "Empty user names are not allowed. Please enter a valid user name."; - return errorMessage; - } - - return errorMessage; - } - - function checkPasswordsMatching(fld1name, fld2name) { - - var stringValue1 = document.getElementsByName(fld1name)[0].value; - var stringValue2 = document.getElementsByName(fld2name)[0].value; - var errorMessage = ""; - - if (stringValue1 != stringValue2) { - errorMessage = "Confirm password does not match with the password. Please re-enter passwords."; - return errorMessage; - } - - return errorMessage; - - } - - function validate() { - var reason = ""; - - reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>); - - if (reason != "") { - alert(reason); - document.getElementsByName("newPassword")[0].clear(); - return false; - } - - reason = checkPasswordsMatching("newPassword", "confirmPassword"); - - if (reason != "") { - alert(reason); - document.getElementsByName("newPassword")[0].clear(); - document.getElementsByName("confirmPassword")[0].clear(); - return false; - } - - return true; - } - - function doProcess() { - if (validate() == true) { - document.passwordForm.submit(); - } - } - - function displayMessage() { - var msg = <%=request.getParameter("message")%>; - if (msg != null) { - alert(msg); - } - } - - - </script> -</head> - -<body onload="displayMessage()"> -<img src="../images/airavata-logo-2.png"> -<h2>Airavata REST API - Local User Store</h2> -<p><b>Manage Local User Store - Change Password of user - <%=userName%></b></p> - -<form action="password.jsp" name="passwordForm" method="POST"> - - <input type="hidden" name="username" value="<%=userName%>"> - <table> - <tr> - <td>New Password</td> - <td><input type="password" name="newPassword"/></td> - </tr> - <tr> - <td>Re-Type Password</td> - <td><input type="password" name="confirmPassword"/></td> - </tr> - </table> - - <table> - <tr> - <td><input type="button" value="Change" onclick= 'doProcess()'></td> - <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td> - </tr> - </table> - -</form> - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/pom.xml b/modules/credential-store-service/credential-store/pom.xml deleted file mode 100644 index d8af25f..0000000 --- a/modules/credential-store-service/credential-store/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor - license agreements. See the NOTICE file distributed with this work for additional - information regarding copyright ownership. The ASF licenses this file to - you under the Apache License, Version 2.0 (theà "License"); you may not use - this file except in compliance with the License. You may obtain a copy of - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY ~ KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata</artifactId> - <version>0.15-SNAPSHOT</version> - <relativePath>../../../pom.xml</relativePath> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-credential-store</artifactId> - <name>Airavata Credential Store</name> - <description>Module to manage credentials</description> - - <dependencies> - <dependency> - <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-api</artifactId> - <version>${oa4mp.version}</version> - </dependency> - <dependency> - <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-loader-oauth1</artifactId> - <version>${oa4mp.version}</version> - <exclusions> - <exclusion> - <groupId>net.oauth.core</groupId> - <artifactId>oauth-httpclient4</artifactId> - </exclusion> - <exclusion> - <groupId>net.oauth.core</groupId> - <artifactId>oauth-consumer</artifactId> - </exclusion> - <exclusion> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - </exclusion> - <exclusion> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.7</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbyclient</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbynet</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbytools</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.4</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jsch</artifactId> - <version>0.1.50</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-email</artifactId> - <version>1.3.2</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-io</artifactId> - <version>1.3.2</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <inherited>true</inherited> - <configuration> - <systemPropertyVariables> - <credential.module.directory>${basedir}</credential.module.directory> - </systemPropertyVariables> - <excludes> - <exclude>**/DAOBaseTestCase.java</exclude> - <exclude>**/MappingDAOTest.java</exclude> - </excludes> - <testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory> - </configuration> - </plugin> - - </plugins> - <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> - <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory> - <testResources> - <testResource> - <directory>${project.basedir}/src/test/resources</directory> - </testResource> - </testResources> - </build> -</project> http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql b/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql deleted file mode 100644 index 91915b6..0000000 --- a/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -CREATE TABLE COMMUNITY_USER -( - GATEWAY_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL, - PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME) -); - - -CREATE TABLE CREDENTIALS -( - GATEWAY_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_NAME VARCHAR(256) NOT NULL, - CREDENTIAL CLOB NOT NULL, - PRIVATE_KEY CLOB NOT NULL, - NOT_BEFORE VARCHAR(256) NOT NULL, - NOT_AFTER VARCHAR(256) NOT NULL, - LIFETIME MEDIUMINT NOT NULL, - REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL, - REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME) -); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql b/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql deleted file mode 100644 index 50d5e0f..0000000 --- a/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -CREATE TABLE COMMUNITY_USER -( - GATEWAY_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL, - PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME) -); - - -CREATE TABLE CREDENTIALS -( - GATEWAY_NAME VARCHAR(256) NOT NULL, - COMMUNITY_USER_NAME VARCHAR(256) NOT NULL, - CREDENTIAL TEXT NOT NULL, - PRIVATE_KEY TEXT NOT NULL, - NOT_BEFORE VARCHAR(256) NOT NULL, - NOT_AFTER VARCHAR(256) NOT NULL, - LIFETIME MEDIUMINT NOT NULL, - REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL, - REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME) -); http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java deleted file mode 100644 index 12105e2..0000000 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.airavata.credential.store.client; - -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.Constants; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.credential.store.cpi.CredentialStoreService; -import org.apache.airavata.credential.store.datamodel.CertificateCredential; -import org.apache.airavata.credential.store.datamodel.CommunityUser; -import org.apache.airavata.credential.store.datamodel.SSHCredential; -import org.apache.thrift.TException; -import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.transport.TSSLTransportFactory; -import org.apache.thrift.transport.TTransport; -import org.apache.thrift.transport.TTransportException; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import org.apache.commons.codec.binary.Base64; - -public class TestSSLClient { - private void invoke() { - TTransport transport; - try { - AiravataUtils.setExecutionAsServer(); - TSSLTransportFactory.TSSLTransportParameters params = - new TSSLTransportFactory.TSSLTransportParameters(); - String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath(); - String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword(); - params.setTrustStore(keystorePath, keystorePWD); - final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_PORT, "8960")); - final String serverHost = ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_HOST, null); - - transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); - TProtocol protocol = new TBinaryProtocol(transport); - - CredentialStoreService.Client client = new CredentialStoreService.Client(protocol); -// testSSHCredential(client); - testCertificateCredential(client); - transport.close(); - } catch (TTransportException e) { - e.printStackTrace(); - }catch (ApplicationSettingsException e) { - e.printStackTrace(); - } - } - - public static void testSSHCredential (CredentialStoreService.Client client){ - try { - SSHCredential sshCredential = new SSHCredential(); - sshCredential.setUsername("test"); - sshCredential.setGatewayId("testGateway"); - sshCredential.setPassphrase("mypassphrase"); - String token = client.addSSHCredential(sshCredential); - System.out.println("SSH Token :" + token); - SSHCredential credential = client.getSSHCredential(token, "testGateway"); - System.out.println("private key : " + credential.getPrivateKey()); - System.out.println("public key : " + credential.getPublicKey()); - }catch (TTransportException e) { - e.printStackTrace(); - } catch (TException e) { - e.printStackTrace(); - } - } - - public static void testCertificateCredential (CredentialStoreService.Client client){ - try { - CertificateCredential certificateCredential = new CertificateCredential(); - CommunityUser communityUser = new CommunityUser("testGateway", "test", "test@ddsd"); - certificateCredential.setCommunityUser(communityUser); - X509Certificate[] x509Certificates = new X509Certificate[1]; - KeyStore ks = KeyStore.getInstance("JKS"); - File keyStoreFile = new File("/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata.jks"); - FileInputStream fis = new FileInputStream(keyStoreFile); - char[] password = "airavata".toCharArray(); - ks.load(fis,password); - x509Certificates[0] = (X509Certificate) ks.getCertificate("airavata"); - Base64 encoder = new Base64(64); - String cert_begin = "-----BEGIN CERTIFICATE-----\n"; - String end_cert = "-----END CERTIFICATE-----"; - byte[] derCert = x509Certificates[0].getEncoded(); - String pemCertPre = new String(encoder.encode(derCert)); - String pemCert = cert_begin + pemCertPre + end_cert; - certificateCredential.setX509Cert(pemCert); - String token = client.addCertificateCredential(certificateCredential); - System.out.println("Certificate Token :" + token); - CertificateCredential credential = client.getCertificateCredential(token, "testGateway"); - System.out.println("certificate : " + credential.getX509Cert()); - System.out.println("gateway name : " + credential.getCommunityUser().getGatewayNmae()); - }catch (TTransportException e) { - e.printStackTrace(); - } catch (TException e) { - e.printStackTrace(); - } catch (KeyStoreException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (CertificateException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static void main(String[] args) { - TestSSLClient c = new TestSSLClient(); - c.invoke(); - - } -}
