import java.util.List;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.springframework.stereotype.Service;
/**
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.rbac.Role;
import org.apache.archiva.redback.role.RoleManager;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.IOUtil;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.role.RoleManager;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.apache.archiva.redback.users.UserManager;
import org.springframework.stereotype.Service;
*/
import org.apache.archiva.redback.rbac.RbacManagerException;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.UserAssignment;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.redback.integration.role.RoleConstants;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.role.RoleManagerException;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.apache.archiva.redback.authentication.AuthenticationDataSource;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.codec.binary.Base64;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
-import org.codehaus.plexus.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.springframework.stereotype.Service;
*/
import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.filter.SpringServletFilter;
import org.slf4j.Logger;
import org.apache.archiva.redback.keys.AuthenticationKey;
import org.apache.archiva.redback.policy.UserSecurityPolicy;
import org.apache.archiva.redback.policy.UserValidationSettings;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.archiva.redback.rbac.UserAssignment;
import org.apache.archiva.redback.users.UserManager;
import org.apache.commons.lang.StringEscapeUtils;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.User;
import org.codehaus.redback.integration.util.RoleSorter;
import org.codehaus.redback.integration.util.UserComparator;
import org.apache.archiva.redback.users.UserManager;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringEscapeUtils;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.redback.integration.util.UserComparator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
*/
import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.keys.KeyNotFoundException;
import org.apache.archiva.redback.policy.CookieSettings;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.codehaus.plexus.redback.keys.jdo.JdoAuthenticationKey;
import org.apache.archiva.redback.keys.memory.MemoryAuthenticationKey;
import org.apache.archiva.redback.keys.memory.MemoryKeyManager;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.rest.api.model.User;
import org.codehaus.redback.rest.api.services.LoginService;
import org.apache.commons.lang.StringUtils;
import org.apache.archiva.redback.keys.AuthenticationKey;
import org.apache.archiva.redback.keys.KeyManagerException;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.rest.api.model.ErrorMessage;
import org.apache.archiva.redback.policy.UserSecurityPolicy;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.integration.mail.Mailer;
import org.codehaus.redback.integration.security.role.RedbackRoleConstants;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticationException;
import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* under the License.
*/
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.policy.PasswordEncoder;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.redback.rest.api.model.ErrorMessage;
import org.codehaus.redback.rest.api.services.RedbackServiceException;
import org.slf4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
import org.apache.archiva.redback.policy.PasswordRuleViolations;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
import org.apache.archiva.redback.rbac.RbacManagerException;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.model.UserCredentials;
import org.codehaus.redback.integration.security.role.RedbackRoleConstants;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.policy.PasswordEncoder;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.keys.KeyNotFoundException;
import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.archiva.redback.policy.PasswordRuleViolations;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.keys.AuthenticationKey;
import org.apache.archiva.redback.keys.KeyManagerException;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.User;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.apache.archiva.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.struts2.action.AuditEvent;
-import org.codehaus.plexus.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.registry.Registry;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
import org.apache.archiva.redback.rbac.Role;
import org.codehaus.plexus.redback.struts2.action.AuditEvent;
import org.codehaus.plexus.redback.struts2.action.CancellableAction;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.apache.struts2.ServletActionContext;
import org.apache.archiva.redback.rbac.RBACManager;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserQuery;
import org.codehaus.plexus.util.StringUtils;
import java.util.List;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
/**
* ExpectedXworkActions
import java.util.ArrayList;
import java.util.List;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.codehaus.redback.integration.checks.xwork.XworkPackageConfig;
import com.opensymphony.xwork2.config.Configuration;
import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.redback.integration.util.AutoLoginCookies;
import org.slf4j.Logger;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.configuration.UserConfiguration;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.role.RoleManagerException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.redback.integration.checks.security.AdminAutoCreateCheck;
import org.codehaus.redback.integration.util.AutoLoginCookies;
import org.apache.archiva.redback.users.UserManager;
import org.apache.struts2.ServletActionContext;
import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.lang.SystemUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.archiva.redback.authorization.AuthorizationResult;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.XWorkTestCase;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.rbac.UserAssignment;
import org.codehaus.plexus.redback.struts2.action.AbstractUserCredentialsAction;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.users.memory.SimpleUser;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.policy.MustChangePasswordException;
import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.memory.SimpleUser;
import org.codehaus.redback.integration.model.AdminEditUserCredentials;
import org.junit.After;
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.springframework.stereotype.Service;
+
+import java.io.Serializable;
+
+/**
+ * @author Jason van Zyl
+ */
+@Service( "securitySession" )
+public class DefaultSecuritySession
+ implements SecuritySession, Serializable
+{
+ private AuthenticationResult authenticationResult;
+
+ private User user;
+
+ // TODO: ambiguity between this authenticated and authentication result's authenticated is dangerous
+ private boolean authenticated;
+
+ public DefaultSecuritySession()
+ {
+ this.authenticationResult = new AuthenticationResult();
+ this.user = null;
+ this.authenticated = false;
+ }
+
+ public DefaultSecuritySession( AuthenticationResult authResult )
+ {
+ this.authenticationResult = authResult;
+ this.user = null;
+ this.authenticated = false;
+ }
+
+ public DefaultSecuritySession( AuthenticationResult authenticationResult, User user )
+ {
+ this.authenticationResult = authenticationResult;
+ this.user = user;
+ this.authenticated = true;
+ }
+
+ public AuthenticationResult getAuthenticationResult()
+ {
+ return authenticationResult;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return ( ( user != null ) && authenticated );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.keys.KeyManager;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.policy.UserSecurityPolicy;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationManager;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authorization.AuthorizationDataSource;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.authorization.AuthorizationResult;
+import org.apache.archiva.redback.authorization.Authorizer;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * DefaultSecuritySystem:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service( "securitySystem" )
+public class DefaultSecuritySystem
+ implements SecuritySystem
+{
+ private Logger log = LoggerFactory.getLogger( DefaultSecuritySystem.class );
+
+ @Inject
+ private AuthenticationManager authnManager;
+
+ @Inject
+ @Named( value = "authorizer#rbac" )
+ private Authorizer authorizer;
+
+ @Inject
+ @Named( value = "userManager#configurable" )
+ private UserManager userManager;
+
+ @Inject
+ @Named( value = "keyManager#cached" )
+ private KeyManager keyManager;
+
+ @Inject
+ private UserSecurityPolicy policy;
+
+ // ----------------------------------------------------------------------------
+ // Authentication: delegate to the authnManager
+ // ----------------------------------------------------------------------------
+
+ /**
+ * delegate to the authentication system for boolean authentication checks,
+ * if the result is authentic then pull the user object from the user
+ * manager and add it to the session. If the result is false return the result in
+ * an authenticated session and a null user object.
+ * <p/>
+ * in the event of a successful authentication and a lack of corresponding user in the
+ * usermanager return a null user as well
+ * <p/>
+ * //todo should this last case create a user in the usermanager?
+ *
+ * @param source
+ * @return
+ * @throws AuthenticationException
+ * @throws UserNotFoundException
+ * @throws MustChangePasswordException
+ * @throws org.apache.archiva.redback.policy.AccountLockedException
+ * @throws MustChangePasswordException
+ */
+ public SecuritySession authenticate( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
+ {
+ // Perform Authentication.
+ AuthenticationResult result = authnManager.authenticate( source );
+
+ log.debug( "authnManager.authenticate() result: {}", result );
+
+ // Process Results.
+ if ( result.isAuthenticated() )
+ {
+ log.debug( "User '{}' authenticated.", result.getPrincipal());
+ User user = userManager.findUser( result.getPrincipal() );
+ if ( user != null )
+ {
+ log.debug( "User '{}' exists.", result.getPrincipal() );
+ log.debug( "User: {}", user );
+ return new DefaultSecuritySession( result, user );
+ }
+ else
+ {
+ log.debug( "User '{}' DOES NOT exist.", result.getPrincipal() );
+ return new DefaultSecuritySession( result );
+ }
+ }
+ else
+ {
+ log.debug( "User '{}' IS NOT authenticated.", result.getPrincipal() );
+ return new DefaultSecuritySession( result );
+ }
+ }
+
+ public boolean isAuthenticated( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
+ {
+ return authenticate( source ).getAuthenticationResult().isAuthenticated();
+ }
+
+ public String getAuthenticatorId()
+ {
+ if ( authnManager == null )
+ {
+ return "<null>";
+ }
+ return authnManager.getId();
+ }
+
+ // ----------------------------------------------------------------------------
+ // Authorization: delegate to the authorizer
+ // ----------------------------------------------------------------------------
+
+ public AuthorizationResult authorize( SecuritySession session, Object permission )
+ throws AuthorizationException
+ {
+ return authorize( session, permission, null );
+ }
+
+ public AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException
+ {
+ AuthorizationDataSource source = null;
+
+ if ( session != null )
+ {
+ User user = session.getUser();
+ if ( user != null )
+ {
+ source = new AuthorizationDataSource( user.getPrincipal(), user, permission, resource );
+ }
+ }
+
+ if ( source == null )
+ {
+ source = new AuthorizationDataSource( null, null, permission, resource );
+ }
+
+ return authorizer.isAuthorized( source );
+ }
+
+ public boolean isAuthorized( SecuritySession session, Object permission )
+ throws AuthorizationException
+ {
+ return isAuthorized( session, permission, null );
+ }
+
+ public boolean isAuthorized( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException
+ {
+ return authorize( session, permission, resource ).isAuthorized();
+ }
+
+ public String getAuthorizerId()
+ {
+ if ( authorizer == null )
+ {
+ return "<null>";
+ }
+ return authorizer.getId();
+ }
+
+ // ----------------------------------------------------------------------------
+ // User Management: delegate to the user manager
+ // ----------------------------------------------------------------------------
+
+ public UserManager getUserManager()
+ {
+ return userManager;
+ }
+
+ public String getUserManagementId()
+ {
+ if ( userManager == null )
+ {
+ return "<null>";
+ }
+ return userManager.getId();
+ }
+
+ public KeyManager getKeyManager()
+ {
+ return keyManager;
+ }
+
+ public String getKeyManagementId()
+ {
+ if ( keyManager == null )
+ {
+ return "<null>";
+ }
+ return keyManager.getId();
+ }
+
+ public UserSecurityPolicy getPolicy()
+ {
+ return policy;
+ }
+
+ public String getPolicyId()
+ {
+ if ( policy == null )
+ {
+ return "<null>";
+ }
+ return policy.getId();
+ }
+
+ public AuthenticationManager getAuthenticationManager()
+ {
+ return authnManager;
+ }
+
+ public Authorizer getAuthorizer()
+ {
+ return authorizer;
+ }
+
+ public AuthenticationManager getAuthnManager()
+ {
+ return authnManager;
+ }
+
+ public void setAuthnManager( AuthenticationManager authnManager )
+ {
+ this.authnManager = authnManager;
+ }
+
+ public void setAuthorizer( Authorizer authorizer )
+ {
+ this.authorizer = authorizer;
+ }
+
+ public void setUserManager( UserManager userManager )
+ {
+ this.userManager = userManager;
+ }
+
+ public void setKeyManager( KeyManager keyManager )
+ {
+ this.keyManager = keyManager;
+ }
+
+ public void setPolicy( UserSecurityPolicy policy )
+ {
+ this.policy = policy;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.users.User;
+
+import java.io.Serializable;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface SecuritySession
+ extends Serializable
+{
+
+ static final String SESSION_KEY = SecuritySession.class.getName();
+
+ static final String USERKEY = "SecuritySessionUser";
+
+ AuthenticationResult getAuthenticationResult();
+
+ User getUser();
+
+ boolean isAuthenticated();
+}
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.policy.UserSecurityPolicy;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.authorization.AuthorizationResult;
+import org.apache.archiva.redback.keys.KeyManager;
+import org.apache.archiva.redback.users.UserManager;
+
+/**
+ * SecuritySystem:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $ID:$
+ *
+ */
+public interface SecuritySystem
+{
+
+ // ----------------------------------------------------------------------------
+ // Authentication
+ // ----------------------------------------------------------------------------
+
+ SecuritySession authenticate( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
+
+ boolean isAuthenticated( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
+
+ // ----------------------------------------------------------------------------
+ // Authorization
+ // ----------------------------------------------------------------------------
+
+ AuthorizationResult authorize( SecuritySession session, Object permission )
+ throws AuthorizationException;
+
+ boolean isAuthorized( SecuritySession session, Object permission )
+ throws AuthorizationException;
+
+ /**
+ * return AuthorizationResult without changing authorization
+ * @param session
+ * @param permission
+ * @param resource
+ * @return
+ * @throws AuthorizationException
+ */
+ AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException;
+
+ boolean isAuthorized( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException;
+
+ // ----------------------------------------------------------------------------
+ // User Management
+ // ----------------------------------------------------------------------------
+
+ UserManager getUserManager();
+
+ // ----------------------------------------------------------------------------
+ // Key Management
+ // ----------------------------------------------------------------------------
+
+ KeyManager getKeyManager();
+
+ // ----------------------------------------------------------------------------
+ // Policy Management
+ // ----------------------------------------------------------------------------
+
+ UserSecurityPolicy getPolicy();
+
+ String getUserManagementId();
+ String getAuthenticatorId();
+ String getAuthorizerId();
+}
+
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * 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.
+ */
+
+/**
+ * SecuritySystemConstants - constants for use with contexts that use plexus-security.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SecuritySystemConstants
+{
+ /**
+ * Key in the sessionScope for the {@link SecuritySession} object.
+ */
+ public static final String SECURITY_SESSION_KEY = "securitySession";
+
+ private SecuritySystemConstants()
+ {
+ // no op
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.system.check;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+/**
+ * EnvironmentCheck - Perform an Environment Check.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface EnvironmentCheck
+{
+
+ /**
+ * Validate the environment.
+ *
+ * @param violations list to populate with environment violations.
+ */
+ void validateEnvironment( List<String> violations );
+}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.springframework.stereotype.Service;
-
-import java.io.Serializable;
-
-/**
- * @author Jason van Zyl
- */
-@Service( "securitySession" )
-public class DefaultSecuritySession
- implements SecuritySession, Serializable
-{
- private AuthenticationResult authenticationResult;
-
- private User user;
-
- // TODO: ambiguity between this authenticated and authentication result's authenticated is dangerous
- private boolean authenticated;
-
- public DefaultSecuritySession()
- {
- this.authenticationResult = new AuthenticationResult();
- this.user = null;
- this.authenticated = false;
- }
-
- public DefaultSecuritySession( AuthenticationResult authResult )
- {
- this.authenticationResult = authResult;
- this.user = null;
- this.authenticated = false;
- }
-
- public DefaultSecuritySession( AuthenticationResult authenticationResult, User user )
- {
- this.authenticationResult = authenticationResult;
- this.user = user;
- this.authenticated = true;
- }
-
- public AuthenticationResult getAuthenticationResult()
- {
- return authenticationResult;
- }
-
- public User getUser()
- {
- return user;
- }
-
- public boolean isAuthenticated()
- {
- return ( ( user != null ) && authenticated );
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.keys.KeyManager;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.authentication.AuthenticationDataSource;
-import org.apache.archiva.redback.authentication.AuthenticationException;
-import org.apache.archiva.redback.authentication.AuthenticationManager;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authorization.AuthorizationDataSource;
-import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.apache.archiva.redback.authorization.AuthorizationResult;
-import org.apache.archiva.redback.authorization.Authorizer;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * DefaultSecuritySystem:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-@Service( "securitySystem" )
-public class DefaultSecuritySystem
- implements SecuritySystem
-{
- private Logger log = LoggerFactory.getLogger( DefaultSecuritySystem.class );
-
- @Inject
- private AuthenticationManager authnManager;
-
- @Inject
- @Named( value = "authorizer#rbac" )
- private Authorizer authorizer;
-
- @Inject
- @Named( value = "userManager#configurable" )
- private UserManager userManager;
-
- @Inject
- @Named( value = "keyManager#cached" )
- private KeyManager keyManager;
-
- @Inject
- private UserSecurityPolicy policy;
-
- // ----------------------------------------------------------------------------
- // Authentication: delegate to the authnManager
- // ----------------------------------------------------------------------------
-
- /**
- * delegate to the authentication system for boolean authentication checks,
- * if the result is authentic then pull the user object from the user
- * manager and add it to the session. If the result is false return the result in
- * an authenticated session and a null user object.
- * <p/>
- * in the event of a successful authentication and a lack of corresponding user in the
- * usermanager return a null user as well
- * <p/>
- * //todo should this last case create a user in the usermanager?
- *
- * @param source
- * @return
- * @throws AuthenticationException
- * @throws UserNotFoundException
- * @throws MustChangePasswordException
- * @throws org.apache.archiva.redback.policy.AccountLockedException
- * @throws MustChangePasswordException
- */
- public SecuritySession authenticate( AuthenticationDataSource source )
- throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
- {
- // Perform Authentication.
- AuthenticationResult result = authnManager.authenticate( source );
-
- log.debug( "authnManager.authenticate() result: {}", result );
-
- // Process Results.
- if ( result.isAuthenticated() )
- {
- log.debug( "User '{}' authenticated.", result.getPrincipal());
- User user = userManager.findUser( result.getPrincipal() );
- if ( user != null )
- {
- log.debug( "User '{}' exists.", result.getPrincipal() );
- log.debug( "User: {}", user );
- return new DefaultSecuritySession( result, user );
- }
- else
- {
- log.debug( "User '{}' DOES NOT exist.", result.getPrincipal() );
- return new DefaultSecuritySession( result );
- }
- }
- else
- {
- log.debug( "User '{}' IS NOT authenticated.", result.getPrincipal() );
- return new DefaultSecuritySession( result );
- }
- }
-
- public boolean isAuthenticated( AuthenticationDataSource source )
- throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
- {
- return authenticate( source ).getAuthenticationResult().isAuthenticated();
- }
-
- public String getAuthenticatorId()
- {
- if ( authnManager == null )
- {
- return "<null>";
- }
- return authnManager.getId();
- }
-
- // ----------------------------------------------------------------------------
- // Authorization: delegate to the authorizer
- // ----------------------------------------------------------------------------
-
- public AuthorizationResult authorize( SecuritySession session, Object permission )
- throws AuthorizationException
- {
- return authorize( session, permission, null );
- }
-
- public AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
- throws AuthorizationException
- {
- AuthorizationDataSource source = null;
-
- if ( session != null )
- {
- User user = session.getUser();
- if ( user != null )
- {
- source = new AuthorizationDataSource( user.getPrincipal(), user, permission, resource );
- }
- }
-
- if ( source == null )
- {
- source = new AuthorizationDataSource( null, null, permission, resource );
- }
-
- return authorizer.isAuthorized( source );
- }
-
- public boolean isAuthorized( SecuritySession session, Object permission )
- throws AuthorizationException
- {
- return isAuthorized( session, permission, null );
- }
-
- public boolean isAuthorized( SecuritySession session, Object permission, Object resource )
- throws AuthorizationException
- {
- return authorize( session, permission, resource ).isAuthorized();
- }
-
- public String getAuthorizerId()
- {
- if ( authorizer == null )
- {
- return "<null>";
- }
- return authorizer.getId();
- }
-
- // ----------------------------------------------------------------------------
- // User Management: delegate to the user manager
- // ----------------------------------------------------------------------------
-
- public UserManager getUserManager()
- {
- return userManager;
- }
-
- public String getUserManagementId()
- {
- if ( userManager == null )
- {
- return "<null>";
- }
- return userManager.getId();
- }
-
- public KeyManager getKeyManager()
- {
- return keyManager;
- }
-
- public String getKeyManagementId()
- {
- if ( keyManager == null )
- {
- return "<null>";
- }
- return keyManager.getId();
- }
-
- public UserSecurityPolicy getPolicy()
- {
- return policy;
- }
-
- public String getPolicyId()
- {
- if ( policy == null )
- {
- return "<null>";
- }
- return policy.getId();
- }
-
- public AuthenticationManager getAuthenticationManager()
- {
- return authnManager;
- }
-
- public Authorizer getAuthorizer()
- {
- return authorizer;
- }
-
- public AuthenticationManager getAuthnManager()
- {
- return authnManager;
- }
-
- public void setAuthnManager( AuthenticationManager authnManager )
- {
- this.authnManager = authnManager;
- }
-
- public void setAuthorizer( Authorizer authorizer )
- {
- this.authorizer = authorizer;
- }
-
- public void setUserManager( UserManager userManager )
- {
- this.userManager = userManager;
- }
-
- public void setKeyManager( KeyManager keyManager )
- {
- this.keyManager = keyManager;
- }
-
- public void setPolicy( UserSecurityPolicy policy )
- {
- this.policy = policy;
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.users.User;
-
-import java.io.Serializable;
-
-/**
- * @author Jason van Zyl
- */
-public interface SecuritySession
- extends Serializable
-{
-
- static final String SESSION_KEY = SecuritySession.class.getName();
-
- static final String USERKEY = "SecuritySessionUser";
-
- AuthenticationResult getAuthenticationResult();
-
- User getUser();
-
- boolean isAuthenticated();
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.authentication.AuthenticationDataSource;
-import org.apache.archiva.redback.authentication.AuthenticationException;
-import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.apache.archiva.redback.authorization.AuthorizationResult;
-import org.apache.archiva.redback.keys.KeyManager;
-import org.apache.archiva.redback.users.UserManager;
-
-/**
- * SecuritySystem:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $ID:$
- *
- */
-public interface SecuritySystem
-{
-
- // ----------------------------------------------------------------------------
- // Authentication
- // ----------------------------------------------------------------------------
-
- SecuritySession authenticate( AuthenticationDataSource source )
- throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
-
- boolean isAuthenticated( AuthenticationDataSource source )
- throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
-
- // ----------------------------------------------------------------------------
- // Authorization
- // ----------------------------------------------------------------------------
-
- AuthorizationResult authorize( SecuritySession session, Object permission )
- throws AuthorizationException;
-
- boolean isAuthorized( SecuritySession session, Object permission )
- throws AuthorizationException;
-
- /**
- * return AuthorizationResult without changing authorization
- * @param session
- * @param permission
- * @param resource
- * @return
- * @throws AuthorizationException
- */
- AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
- throws AuthorizationException;
-
- boolean isAuthorized( SecuritySession session, Object permission, Object resource )
- throws AuthorizationException;
-
- // ----------------------------------------------------------------------------
- // User Management
- // ----------------------------------------------------------------------------
-
- UserManager getUserManager();
-
- // ----------------------------------------------------------------------------
- // Key Management
- // ----------------------------------------------------------------------------
-
- KeyManager getKeyManager();
-
- // ----------------------------------------------------------------------------
- // Policy Management
- // ----------------------------------------------------------------------------
-
- UserSecurityPolicy getPolicy();
-
- String getUserManagementId();
- String getAuthenticatorId();
- String getAuthorizerId();
-}
-
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * 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.
- */
-
-/**
- * SecuritySystemConstants - constants for use with contexts that use plexus-security.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SecuritySystemConstants
-{
- /**
- * Key in the sessionScope for the {@link SecuritySession} object.
- */
- public static final String SECURITY_SESSION_KEY = "securitySession";
-
- private SecuritySystemConstants()
- {
- // no op
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system.check;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.List;
-
-/**
- * EnvironmentCheck - Perform an Environment Check.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface EnvironmentCheck
-{
-
- /**
- * Validate the environment.
- *
- * @param violations list to populate with environment violations.
- */
- void validateEnvironment( List<String> violations );
-}
default-lazy-init="true">
<context:annotation-config />
- <context:component-scan base-package="org.codehaus.plexus.redback.system"/>
+ <context:component-scan base-package="org.apache.archiva.redback.system"/>
</beans>
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Jason van Zyl
+ */
+public class DefaultSecureApplication
+ implements SecureApplication
+{
+}
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Jason van Zyl
+ */
+public interface SecureApplication
+{
+ String ROLE = SecureApplication.class.getName();
+}
--- /dev/null
+package org.apache.archiva.redback.system;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.archiva.redback.authentication.AuthenticationManager;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+
+
+/**
+ * TestAuthenticationManager:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $ID:$
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class TestAuthenticationManager
+ extends TestCase
+{
+
+ @Inject
+ AuthenticationManager authManager;
+
+ @Test
+ public void testAuthenticatorPopulation()
+ throws Exception
+ {
+ assertEquals( 1, authManager.getAuthenticators().size() );
+ }
+
+}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * 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.
- */
-
-/**
- * @author Jason van Zyl
- */
-public class DefaultSecureApplication
- implements SecureApplication
-{
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * 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.
- */
-
-/**
- * @author Jason van Zyl
- */
-public interface SecureApplication
-{
- String ROLE = SecureApplication.class.getName();
-}
+++ /dev/null
-package org.codehaus.plexus.redback.system;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.redback.authentication.AuthenticationManager;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-
-
-/**
- * TestAuthenticationManager:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $ID:$
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class TestAuthenticationManager
- extends TestCase
-{
-
- @Inject
- AuthenticationManager authManager;
-
- @Test
- public void testAuthenticatorPopulation()
- throws Exception
- {
- assertEquals( 1, authManager.getAuthenticators().size() );
- }
-
-}
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean name="jdoFactory#users" class="org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory">
<property name="driverName" value="org.hsqldb.jdbcDriver"/>