From 5f2cfdabb8dc628beea37ca8510f9c3a3f5954ee Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sun, 28 Jun 2009 09:44:35 +0000 Subject: [PATCH] MNG-4222: Introducing JSecurity to manage authentication against remote repositories git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@789079 13f79535-47bb-0310-9956-ffa450edef68 --- ...efaultRepositorySystemSecurityManager.java | 25 +++++++++++++++++++ .../RepositorySystemSecurityManager.java | 11 ++++++++ 2 files changed, 36 insertions(+) create mode 100644 maven-repository/src/main/java/org/apache/maven/repository/security/DefaultRepositorySystemSecurityManager.java create mode 100644 maven-repository/src/main/java/org/apache/maven/repository/security/RepositorySystemSecurityManager.java diff --git a/maven-repository/src/main/java/org/apache/maven/repository/security/DefaultRepositorySystemSecurityManager.java b/maven-repository/src/main/java/org/apache/maven/repository/security/DefaultRepositorySystemSecurityManager.java new file mode 100644 index 0000000000..7409e34037 --- /dev/null +++ b/maven-repository/src/main/java/org/apache/maven/repository/security/DefaultRepositorySystemSecurityManager.java @@ -0,0 +1,25 @@ +package org.apache.maven.repository.security; + +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.jsecurity.authc.AuthenticationException; +import org.jsecurity.authc.AuthenticationInfo; +import org.jsecurity.authc.AuthenticationToken; +import org.jsecurity.authc.Authenticator; + +@Component(role=RepositorySystemSecurityManager.class) +public class DefaultRepositorySystemSecurityManager + implements RepositorySystemSecurityManager +{ + @Requirement + private Authenticator authenticator; + + public AuthenticationInfo authenticate( AuthenticationToken token ) + throws AuthenticationException + { + AuthenticationInfo authenticationInfo = authenticator.authenticate( token ); + + return authenticationInfo; + } + +} diff --git a/maven-repository/src/main/java/org/apache/maven/repository/security/RepositorySystemSecurityManager.java b/maven-repository/src/main/java/org/apache/maven/repository/security/RepositorySystemSecurityManager.java new file mode 100644 index 0000000000..b6e68781d5 --- /dev/null +++ b/maven-repository/src/main/java/org/apache/maven/repository/security/RepositorySystemSecurityManager.java @@ -0,0 +1,11 @@ +package org.apache.maven.repository.security; + +import org.jsecurity.authc.AuthenticationException; +import org.jsecurity.authc.AuthenticationInfo; +import org.jsecurity.authc.AuthenticationToken; + +public interface RepositorySystemSecurityManager +{ + public AuthenticationInfo authenticate( AuthenticationToken token ) + throws AuthenticationException; +}