archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maria Odea Ching" <och...@apache.org>
Subject Re: svn commit: r691581 - in /archiva/trunk/archiva-modules/archiva-web: archiva-security/src/main/java/org/apache/maven/archiva/security/ archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ archiva-webapp/src/main/java/org/apache/maven
Date Wed, 10 Sep 2008 03:36:16 GMT
FYI, I created a new jira for the removal of the 'redback.default.guest'
property in Archiva (MRM-938), and already closed MRM-915 and MRM-926 in
preparation for the 1.1.2 release :)

Thanks,
Deng

On Thu, Sep 4, 2008 at 9:42 AM, Maria Odea Ching <oching@apache.org> wrote:

> Okey dokey, thanks Emmanuel! :)
>
> -Deng
>
>
> On Wed, Sep 3, 2008 at 7:53 PM, Emmanuel Venisse <
> emmanuel.venisse@gmail.com> wrote:
>
>> Great, I'll try to test it on with my LDAP config.
>> For information, I'll work on redback to remove 'redback.default.guest'
>> property because it is a non-sense to use a real user for guest. When it
>> will be done, I'll update redback in Archiva to 1.2-SNASPSHOT and change
>> your getGuest() method.
>>
>> Emmanuel
>>
>> On Wed, Sep 3, 2008 at 1:45 PM, <oching@apache.org> wrote:
>>
>> > Author: oching
>> > Date: Wed Sep  3 04:45:11 2008
>> > New Revision: 691581
>> >
>> > URL: http://svn.apache.org/viewvc?rev=691581&view=rev
>> > Log:
>> > [MRM-915] and [MRM-926]
>> > -get the default guest users from redback config files instead of the
>> > hardcoded constant value
>> >
>> > Modified:
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
>> >
>> >
>>  archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -19,27 +19,38 @@
>> >  * under the License.
>> >  */
>> >
>> > -import java.util.HashMap;
>> >  import java.util.Map;
>> >
>> >  import org.apache.maven.archiva.security.ArchivaRoleConstants;
>> >  import org.codehaus.plexus.redback.system.SecuritySession;
>> >  import org.codehaus.plexus.redback.system.SecuritySystemConstants;
>> >  import org.codehaus.plexus.redback.users.User;
>> > +import org.codehaus.plexus.registry.Registry;
>> >
>> >  /**
>> >  * ArchivaXworkUser
>> >  *
>> >  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
>> >  * @version $Id$
>> > + *
>> > + * @plexus.component
>> > role="org.apache.maven.archiva.security.ArchivaXworkUser"
>> >  */
>> >  public class ArchivaXworkUser
>> >  {
>> > -    public static String getActivePrincipal( Map<String, Object>
>> > sessionMap )
>> > -    {
>> > +    /**
>> > +     * @plexus.requirement role-hint="commons-configuration"
>> > +     */
>> > +    private Registry registry;
>> > +
>> > +    private static final String KEY = "org.codehaus.plexus.redback";
>> > +
>> > +    private static String guest;
>> > +
>> > +    public String getActivePrincipal( Map<String, Object> sessionMap
)
>> > +    {
>> >         if ( sessionMap == null )
>> >         {
>> > -            return ArchivaRoleConstants.PRINCIPAL_GUEST;
>> > +            return getGuest();
>> >         }
>> >
>> >        SecuritySession securitySession =
>> > @@ -52,15 +63,26 @@
>> >
>> >         if ( securitySession == null )
>> >         {
>> > -            return ArchivaRoleConstants.PRINCIPAL_GUEST;
>> > +            return getGuest();
>> >         }
>> >
>> >         User user = securitySession.getUser();
>> >         if ( user == null )
>> >         {
>> > -            return ArchivaRoleConstants.PRINCIPAL_GUEST;
>> > +            return getGuest();
>> >         }
>> >
>> >         return (String) user.getPrincipal();
>> > +    }
>> > +
>> > +    public String getGuest()
>> > +    {
>> > +        if( guest == null || "".equals( guest ) )
>> > +        {
>> > +            Registry subset = registry.getSubset( KEY );
>> > +            guest = subset.getString( "redback.default.guest",
>> > ArchivaRoleConstants.PRINCIPAL_GUEST );
>> > +        }
>> > +
>> > +        return guest;
>> >     }
>> >  }
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -52,6 +52,11 @@
>> >      */
>> >     private UserRepositories userRepositories;
>> >
>> > +    /**
>> > +     * @plexus.requirement
>> > +     */
>> > +    private ArchivaXworkUser archivaXworkUser;
>> > +
>> >     private BrowsingResults results;
>> >
>> >     private String groupId;
>> > @@ -121,7 +126,7 @@
>> >
>> >     private String getPrincipal()
>> >     {
>> > -        return ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        return archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >     }
>> >
>> >     private List<String> getObservableRepos()
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -75,6 +75,11 @@
>> >      */
>> >     private UserRepositories userRepositories;
>> >
>> > +    /**
>> > +     * @plexus.requirement
>> > +     */
>> > +    private ArchivaXworkUser archivaXworkUser;
>> > +
>> >     private static final String RESULTS = "results";
>> >
>> >     private static final String ARTIFACT = "artifact";
>> > @@ -195,7 +200,7 @@
>> >
>> >     private String getPrincipal()
>> >     {
>> > -        return ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        return archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >     }
>> >
>> >     private List<String> getObservableRepos()
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -59,6 +59,11 @@
>> >      * @plexus.requirement
>> >      */
>> >     private UserRepositories userRepositories;
>> > +
>> > +    /**
>> > +     * @plexus.requirement
>> > +     */
>> > +    private ArchivaXworkUser archivaXworkUser;
>> >
>> >     /* .\ Input Parameters \.________________________________________ */
>> >
>> > @@ -179,7 +184,7 @@
>> >
>> >     private String getPrincipal()
>> >     {
>> > -        return ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        return archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >     }
>> >
>> >     private List<String> getObservableRepos()
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -86,6 +86,11 @@
>> >       * @plexus.requirement
>> >       */
>> >      private RepositoryContentConsumers consumers;
>> > +
>> > +     /**
>> > +      * @plexus.requirement
>> > +      */
>> > +     private ArchivaXworkUser archivaXworkUser;
>> >
>> >     /**
>> >      * The groupId of the artifact to be deployed.
>> > @@ -456,7 +461,7 @@
>> >
>> >     private String getPrincipal()
>> >     {
>> > -        return ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        return archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >     }
>> >
>> >     private void copyFile( File sourceFile, File targetPath, String
>> > targetFilename )
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -40,6 +40,7 @@
>> >  import org.apache.maven.archiva.security.AccessDeniedException;
>> >  import org.apache.maven.archiva.security.ArchivaRoleConstants;
>> >  import org.apache.maven.archiva.security.ArchivaSecurityException;
>> > +import org.apache.maven.archiva.security.ArchivaXworkUser;
>> >  import org.apache.maven.archiva.security.PrincipalNotFoundException;
>> >  import org.apache.maven.archiva.security.ServletAuthenticator;
>> >  import org.apache.maven.archiva.security.UserRepositories;
>> > @@ -90,6 +91,8 @@
>> >     private ServletAuthenticator servletAuth;
>> >
>> >     private HttpAuthenticator httpAuth;
>> > +
>> > +    private ArchivaXworkUser archivaXworkUser;
>> >
>> >     public void init( javax.servlet.ServletConfig servletConfig )
>> >         throws ServletException
>> > @@ -102,6 +105,7 @@
>> >             (ServletAuthenticator) wac.getBean(
>> > PlexusToSpringUtils.buildSpringId( ServletAuthenticator.class.getName()
>> ) );
>> >         httpAuth =
>> >             (HttpAuthenticator) wac.getBean(
>> > PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE, "basic" ) );
>> > +        archivaXworkUser = (ArchivaXworkUser) wac.getBean(
>> > PlexusToSpringUtils.buildSpringId( ArchivaXworkUser.class ) );
>> >     }
>> >
>> >     public void doGet( HttpServletRequest req, HttpServletResponse res )
>> > @@ -269,7 +273,7 @@
>> >
>> >                 if ( usernamePassword == null ||
>> > usernamePassword.trim().equals( "" ) )
>> >                 {
>> > -                    repoIds = getObservableRepos(
>> > ArchivaRoleConstants.PRINCIPAL_GUEST );
>> > +                    repoIds = getObservableRepos(
>> > archivaXworkUser.getGuest() );
>> >                 }
>> >                 else
>> >                 {
>> > @@ -279,7 +283,7 @@
>> >             }
>> >             else
>> >             {
>> > -                repoIds = getObservableRepos(
>> > ArchivaRoleConstants.PRINCIPAL_GUEST );
>> > +                repoIds = getObservableRepos(
>> archivaXworkUser.getGuest()
>> > );
>> >             }
>> >         }
>> >         else
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -97,17 +97,20 @@
>> >     private final MimeTypes mimeTypes;
>> >
>> >     private List<AuditListener> auditListeners;
>> > +
>> > +    private ArchivaXworkUser archivaXworkUser;
>> >
>> >     public ArchivaDavResource( String localResource, String
>> > logicalResource, ManagedRepositoryConfiguration repository,
>> >                                DavSession session,
>> > ArchivaDavResourceLocator locator, DavResourceFactory factory,
>> >                                MimeTypes mimeTypes, List<AuditListener>
>> > auditListeners,
>> > -                               RepositoryContentConsumers consumers )
>> > +                               RepositoryContentConsumers consumers,
>> > ArchivaXworkUser archivaXworkUser )
>> >     {
>> >         this.localResource = new File( localResource );
>> >         this.logicalResource = logicalResource;
>> >         this.locator = locator;
>> >         this.factory = factory;
>> >         this.session = session;
>> > +        this.archivaXworkUser = archivaXworkUser;
>> >
>> >         // TODO: push into locator as well as moving any references out
>> of
>> > the resource factory
>> >         this.repository = repository;
>> > @@ -121,10 +124,10 @@
>> >     public ArchivaDavResource( String localResource, String
>> > logicalResource, ManagedRepositoryConfiguration repository,
>> >                                String remoteAddr, DavSession session,
>> > ArchivaDavResourceLocator locator,
>> >                                DavResourceFactory factory, MimeTypes
>> > mimeTypes, List<AuditListener> auditListeners,
>> > -                               RepositoryContentConsumers consumers )
>> > +                               RepositoryContentConsumers consumers,
>> > ArchivaXworkUser archivaXworkUser )
>> >     {
>> >         this( localResource, logicalResource, repository, session,
>> locator,
>> > factory, mimeTypes, auditListeners,
>> > -              consumers );
>> > +              consumers, archivaXworkUser );
>> >
>> >         this.remoteAddr = remoteAddr;
>> >     }
>> > @@ -614,7 +617,7 @@
>> >
>> >     private void triggerAuditEvent( String remoteIP, String
>> repositoryId,
>> > String resource, String action )
>> >     {
>> > -        String activePrincipal = ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        String activePrincipal = archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >         AuditEvent event = new AuditEvent( repositoryId,
>> activePrincipal,
>> > resource, action );
>> >         event.setRemoteIP( remoteIP );
>> >
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -174,6 +174,11 @@
>> >      * @plexus.requirement role-hint="md5";
>> >      */
>> >     private Digester digestMd5;
>> > +
>> > +    /**
>> > +     * @plexus.requirement
>> > +     */
>> > +    private ArchivaXworkUser archivaXworkUser;
>> >
>> >     public DavResource createResource( final DavResourceLocator locator,
>> > final DavServletRequest request,
>> >                                        final DavServletResponse response
>> )
>> > @@ -317,7 +322,7 @@
>> >                         ArchivaDavResource metadataChecksumResource =
>> >                             new ArchivaDavResource(
>> > metadataChecksum.getAbsolutePath(), logicalResource.getPath(), null,
>> >
>> > request.getRemoteAddr(), request.getDavSession(), archivaLocator, this,
>> > -                                                    mimeTypes,
>> > auditListeners, consumers );
>> > +                                                    mimeTypes,
>> > auditListeners, consumers, archivaXworkUser );
>> >                         availableResources.add( 0,
>> metadataChecksumResource
>> > );
>> >                     }
>> >                 }
>> > @@ -349,7 +354,7 @@
>> >                         ArchivaDavResource metadataResource =
>> >                             new ArchivaDavResource(
>> > resourceFile.getAbsolutePath(), logicalResource.getPath(), null,
>> >
>> > request.getRemoteAddr(), request.getDavSession(), archivaLocator, this,
>> > -                                                    mimeTypes,
>> > auditListeners, consumers );
>> > +                                                    mimeTypes,
>> > auditListeners, consumers, archivaXworkUser );
>> >                         availableResources.add( 0, metadataResource );
>> >                     }
>> >                     catch ( RepositoryMetadataException r )
>> > @@ -398,7 +403,7 @@
>> >             resource =
>> >                 new ArchivaDavResource( resourceFile.getAbsolutePath(),
>> > logicalResource,
>> >
>> managedRepository.getRepository(),
>> > davSession, archivaLocator, this, mimeTypes,
>> > -                                        auditListeners, consumers );
>> > +                                        auditListeners, consumers,
>> > archivaXworkUser );
>> >         }
>> >         resource.addLockManager(lockManager);
>> >         return resource;
>> > @@ -423,7 +428,7 @@
>> >         ArchivaDavResource resource =
>> >             new ArchivaDavResource( resourceFile.getAbsolutePath(),
>> > logicalResource.getPath(),
>> >                                     managedRepository.getRepository(),
>> > request.getRemoteAddr(),
>> > -                                    request.getDavSession(), locator,
>> > this, mimeTypes, auditListeners, consumers );
>> > +                                    request.getDavSession(), locator,
>> > this, mimeTypes, auditListeners, consumers, archivaXworkUser );
>> >
>> >         if ( !resource.isCollection() )
>> >         {
>> > @@ -468,7 +473,7 @@
>> >                     new ArchivaDavResource(
>> resourceFile.getAbsolutePath(),
>> > logicalResource.getPath(),
>> >
>> > managedRepository.getRepository(), request.getRemoteAddr(),
>> >                                             request.getDavSession(),
>> > locator, this, mimeTypes, auditListeners,
>> > -                                            consumers );
>> > +                                            consumers, archivaXworkUser
>> );
>> >             }
>> >         }
>> >         return resource;
>> > @@ -497,7 +502,7 @@
>> >
>> >         return new ArchivaDavResource( resourceFile.getAbsolutePath(),
>> > logicalResource.getPath(),
>> >
>>  managedRepository.getRepository(),
>> > request.getRemoteAddr(),
>> > -                                       request.getDavSession(),
>> locator,
>> > this, mimeTypes, auditListeners, consumers );
>> > +                                       request.getDavSession(),
>> locator,
>> > this, mimeTypes, auditListeners, consumers, archivaXworkUser );
>> >     }
>> >
>> >     private boolean fetchContentFromProxies( ManagedRepositoryContent
>> > managedRepository, DavServletRequest request,
>> > @@ -622,7 +627,7 @@
>> >     // TODO: remove?
>> >     private void triggerAuditEvent( String remoteIP, String
>> repositoryId,
>> > String resource, String action )
>> >     {
>> > -        String activePrincipal = ArchivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> > +        String activePrincipal = archivaXworkUser.getActivePrincipal(
>> > ActionContext.getContext().getSession() );
>> >         AuditEvent event = new AuditEvent( repositoryId,
>> activePrincipal,
>> > resource, action );
>> >         event.setRemoteIP( remoteIP );
>> >
>> > @@ -769,7 +774,7 @@
>> >                             request.getSession().getAttribute(
>> > SecuritySystemConstants.SECURITY_SESSION_KEY ) );
>> >         }
>> >
>> > -        String activePrincipal = ArchivaXworkUser.getActivePrincipal(
>> > sessionMap );
>> > +        String activePrincipal = archivaXworkUser.getActivePrincipal(
>> > sessionMap );
>> >         boolean allow = isAllowedToContinue( request, repositories,
>> > activePrincipal );
>> >
>> >         if( allow )
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
>> > Wed Sep  3 04:45:11 2008
>> > @@ -20,7 +20,6 @@
>> >  */
>> >
>> >  import java.io.File;
>> > -import java.util.List;
>> >
>> >  import org.apache.commons.io.FileUtils;
>> >  import org.apache.jackrabbit.webdav.DavException;
>> > @@ -37,12 +36,11 @@
>> >  import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
>> >  import org.apache.jackrabbit.webdav.lock.Type;
>> >  import
>> > org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
>> > -import org.apache.maven.archiva.repository.audit.AuditListener;
>> >  import
>> > org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
>> > +import org.apache.maven.archiva.security.ArchivaXworkUser;
>> >  import org.apache.maven.archiva.webdav.util.MimeTypes;
>> >  import org.codehaus.plexus.spring.PlexusInSpringTestCase;
>> >  import org.codehaus.plexus.spring.PlexusToSpringUtils;
>> > -import org.easymock.MockControl;
>> >
>> >  import edu.emory.mathcs.backport.java.util.Collections;
>> >
>> > @@ -69,6 +67,8 @@
>> >     private RepositoryContentConsumers consumers;
>> >
>> >     private ManagedRepositoryConfiguration repository = new
>> > ManagedRepositoryConfiguration();
>> > +
>> > +    private ArchivaXworkUser archivaXworkUser;
>> >
>> >     @Override
>> >     protected void setUp()
>> > @@ -87,6 +87,7 @@
>> >         lockManager = new SimpleLockManager();
>> >         resource.addLockManager(lockManager);
>> >         consumers = new RepositoryContentConsumers();
>> > +        archivaXworkUser = (ArchivaXworkUser)
>> > getApplicationContext().getBean( PlexusToSpringUtils.buildSpringId(
>> > ArchivaXworkUser.class ) );
>> >     }
>> >
>> >     @Override
>> > @@ -101,7 +102,7 @@
>> >     private DavResource getDavResource(String logicalPath, File file)
>> >     {
>> >         return new ArchivaDavResource( file.getAbsolutePath(),
>> logicalPath,
>> > repository, session, resourceLocator,
>> > -                                       resourceFactory, mimeTypes,
>> > Collections.emptyList(), consumers );
>> > +                                       resourceFactory, mimeTypes,
>> > Collections.emptyList(), consumers, archivaXworkUser );
>> >     }
>> >
>> >     public void testDeleteNonExistantResourceShould404()
>> > @@ -302,7 +303,7 @@
>> >
>> >         public DavResource createResource(DavResourceLocator locator,
>> > DavSession session) throws DavException {
>> >             return new ArchivaDavResource( baseDir.getAbsolutePath(),
>> "/",
>> > repository, session, resourceLocator,
>> > -                                           resourceFactory, mimeTypes,
>> > Collections.emptyList(), consumers );
>> > +                                           resourceFactory, mimeTypes,
>> > Collections.emptyList(), consumers, archivaXworkUser );
>> >         }
>> >     }
>> >  }
>> >
>> > Modified:
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
>> > URL:
>> >
>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml?rev=691581&r1=691580&r2=691581&view=diff
>> >
>> >
>> ==============================================================================
>> > ---
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
>> > (original)
>> > +++
>> >
>> archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
>> > Wed Sep  3 04:45:11 2008
>> > @@ -165,6 +165,10 @@
>> >           <role>org.codehaus.plexus.digest.Digester</role>
>> >           <role-hint>md5</role-hint>
>> >           <field-name>digestMd5</field-name>
>> > +        </requirement>
>> > +        <requirement>
>> > +
>>  <role>org.apache.maven.archiva.security.ArchivaXworkUser</role>
>> > +          <field-name>archivaXworkUser</field-name>
>> >         </requirement>
>> >       </requirements>
>> >     </component>
>> >
>> >
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message