mirror of
https://github.com/apache/archiva.git
synced 2025-02-06 18:19:02 +00:00
starting to use the plexus-security bits now, the store-model.xml file will eventually going away, the login and logout actions now work and you can register a user now and login. doing so doesn't do anything for you atm, but its the start showing the security system being used in actions. next will come authorization implementation and usage
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@441128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0625404a5d
commit
158f91cccb
@ -109,6 +109,47 @@
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
</dependency>
|
||||
<!-- Plexus Security Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-system</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-ui-web</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-authorization-rbac-ui-web</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-authentication-provider-memory</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-user-management-provider-memory</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-authorization-rbac-store-memory</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-authorization-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.security</groupId>
|
||||
<artifactId>plexus-security-authorization-rbac-authorizer</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
1
archiva-webapp/rbac-store-model.xml
Normal file
1
archiva-webapp/rbac-store-model.xml
Normal file
@ -0,0 +1 @@
|
||||
<model/>
|
@ -59,6 +59,42 @@
|
||||
</levels>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
|
||||
<!-- plexus security components -->
|
||||
<component>
|
||||
<role>org.codehaus.plexus.security.system.SecuritySystem</role>
|
||||
<implementation>org.codehaus.plexus.security.system.DefaultSecuritySystem</implementation>
|
||||
<role-hint>default</role-hint>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.security.authentication.Authenticator</role>
|
||||
<role-hint>memory</role-hint>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.security.authorization.Authorizer</role>
|
||||
<role-hint>rbac</role-hint>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.security.user.UserManager</role>
|
||||
<role-hint>memory</role-hint>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.codehaus.plexus.security.authorization.Authorizer</role>
|
||||
<role-hint>rbac</role-hint>
|
||||
<implementation>org.codehaus.plexus.security.authorization.rbac.RbacAuthorizer</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.security.authorization.rbac.store.RbacStore</role>
|
||||
<role-hint>memory</role-hint>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
|
||||
</components>
|
||||
|
||||
<!-- Override default configuration of components -->
|
||||
|
@ -124,6 +124,21 @@
|
||||
</result>
|
||||
<result name="notFound" type="httpheader">404</result>
|
||||
</action>
|
||||
|
||||
<!-- plexus security actions -->
|
||||
<action name="login" class="session" method="login">
|
||||
<result name="input">/WEB-INF/jsp/login.jsp</result>
|
||||
<result name="success" type="redirect-action">browse</result>
|
||||
</action>
|
||||
|
||||
<action name="logout" class="session" method="logout">
|
||||
<result>/WEB-INF/jsp/logout.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="register" class="registerUser" method="createUser">
|
||||
<result name="input">/WEB-INF/jsp/register.jsp</result>
|
||||
<result name="success" type="redirect-action">login</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<!-- Configuration for the admin package. -->
|
||||
|
@ -58,7 +58,15 @@
|
||||
|
||||
<div id="breadcrumbs">
|
||||
<div class="xleft">
|
||||
<%-- TODO: login --%>
|
||||
<ww:url id="loginUrl" action="login" namespace="/"/>
|
||||
<ww:url id="logoutUrl" action="logout" namespace="/"/>
|
||||
<ww:url id="registerUrl" action="register" namespace="/"/>
|
||||
<ww:if test="${sessionScope.authStatus != true}">
|
||||
<ww:a href="%{loginUrl}">Login</ww:a> or <ww:a href="%{registerUrl}">Register</ww:a>
|
||||
</ww:if>
|
||||
<ww:else>
|
||||
Welcome, <b>${sessionScope.user.username}</b> - <ww:a href="%{logoutUrl}">Logout</ww:a>
|
||||
</ww:else>
|
||||
</div>
|
||||
|
||||
<div class="xright">
|
||||
|
57
archiva-webapp/src/main/webapp/WEB-INF/jsp/login.jsp
Normal file
57
archiva-webapp/src/main/webapp/WEB-INF/jsp/login.jsp
Normal file
@ -0,0 +1,57 @@
|
||||
<%--
|
||||
~ Copyright 2005-2006 The Apache Software Foundation.
|
||||
~
|
||||
~ Licensed 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.
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="ww" uri="/webwork" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Login Page</title>
|
||||
<ww:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Login</h1>
|
||||
|
||||
<div id="contentArea">
|
||||
<div id="nameColumn">
|
||||
<ww:form action="login">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Username:</td>
|
||||
<td><ww:textfield name="username"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td><ww:password name="password"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><ww:submit name="Login"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</ww:form>
|
||||
<p>
|
||||
<ww:url id="registerUrl" action="register" namespace="/"/>
|
||||
|
||||
New user? - <ww:a href="%{registerUrl}">Register!</ww:a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
37
archiva-webapp/src/main/webapp/WEB-INF/jsp/logout.jsp
Normal file
37
archiva-webapp/src/main/webapp/WEB-INF/jsp/logout.jsp
Normal file
@ -0,0 +1,37 @@
|
||||
<%--
|
||||
~ Copyright 2005-2006 The Apache Software Foundation.
|
||||
~
|
||||
~ Licensed 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.
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="ww" uri="/webwork" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Logout Page</title>
|
||||
<ww:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Logout</h1>
|
||||
|
||||
<div id="contentArea">
|
||||
<div id="nameColumn">
|
||||
You have been successfully logged out!
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
60
archiva-webapp/src/main/webapp/WEB-INF/jsp/register.jsp
Normal file
60
archiva-webapp/src/main/webapp/WEB-INF/jsp/register.jsp
Normal file
@ -0,0 +1,60 @@
|
||||
<%--
|
||||
~ Copyright 2005-2006 The Apache Software Foundation.
|
||||
~
|
||||
~ Licensed 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.
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="ww" uri="/webwork" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Registration Page</title>
|
||||
<ww:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Registration</h1>
|
||||
|
||||
<div id="contentArea">
|
||||
<div id="nameColumn">
|
||||
<ww:form action="register">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Username:</td>
|
||||
<td><ww:textfield name="username"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td><ww:password name="password"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Full Name:</td>
|
||||
<td><ww:textfield name="fullName"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email Address:</td>
|
||||
<td><ww:textfield name="email"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><ww:submit name="Register"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</ww:form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user