de.theit.hudson.crowd
Class CrowdSecurityRealm

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<hudson.security.SecurityRealm>
      extended by hudson.security.SecurityRealm
          extended by hudson.security.AbstractPasswordBasedSecurityRealm
              extended by de.theit.hudson.crowd.CrowdSecurityRealm
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.security.SecurityRealm>, org.acegisecurity.userdetails.UserDetailsService

public class CrowdSecurityRealm
extends hudson.security.AbstractPasswordBasedSecurityRealm

This class provides the Hudson / Jenkins security realm for authenticating users against a remote Crowd server.

Since:
06.09.2011
Version:
$Id$
Author:
Thorsten Heit (theit@gmx.de)

Nested Class Summary
static class CrowdSecurityRealm.DescriptorImpl
          Descriptor for CrowdSecurityRealm.
 
Nested classes/interfaces inherited from class hudson.security.SecurityRealm
hudson.security.SecurityRealm.SecurityComponents
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 String applicationName
          Contains the application name to access Crowd.
 String group
          Contains the Crowd group to which a user must belong to.
 boolean nestedGroups
          Specifies whether nested groups can be used.
 String password
          Contains the application password to access Crowd.
 String url
          Contains the Crowd server URL.
 
Fields inherited from class hudson.security.SecurityRealm
AUTHENTICATED_AUTHORITY, LIST, NO_AUTHENTICATION
 
Constructor Summary
CrowdSecurityRealm(String url, String applicationName, String password, String group, boolean nestedGroups)
          Default constructor.
 
Method Summary
protected  org.acegisecurity.userdetails.UserDetails authenticate(String pUsername, String pPassword)
          
 javax.servlet.Filter createFilter(javax.servlet.FilterConfig filterConfig)
          
 hudson.security.SecurityRealm.SecurityComponents createSecurityComponents()
          
 void doLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          
 hudson.security.GroupDetails loadGroupByGroupname(String groupname)
          
 org.acegisecurity.userdetails.UserDetails loadUserByUsername(String username)
          
 
Methods inherited from class hudson.security.AbstractPasswordBasedSecurityRealm
createCliAuthenticator
 
Methods inherited from class hudson.security.SecurityRealm
all, allowsSignup, canLogOut, commenceSignup, doCaptcha, findBean, getAuthenticationGatewayUrl, getDescriptor, getLoginUrl, getPostLogOutUrl, getSecurityComponents, validateCaptcha
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

public final String url
Contains the Crowd server URL.


applicationName

public final String applicationName
Contains the application name to access Crowd.


password

public final String password
Contains the application password to access Crowd.


group

public final String group
Contains the Crowd group to which a user must belong to.


nestedGroups

public final boolean nestedGroups
Specifies whether nested groups can be used.

Constructor Detail

CrowdSecurityRealm

@DataBoundConstructor
public CrowdSecurityRealm(String url,
                                               String applicationName,
                                               String password,
                                               String group,
                                               boolean nestedGroups)
Default constructor. Fields in config.jelly must match the parameter names in the "DataBoundConstructor".

Parameters:
url - The URL for Crowd.
applicationName - The application name.
password - The application password.
group - The group to which users must belong to. If this parameter is not specified, a users group membership will not be checked.
nestedGroups - true when nested groups may be used. false else.
Method Detail

createSecurityComponents

public hudson.security.SecurityRealm.SecurityComponents createSecurityComponents()

Overrides:
createSecurityComponents in class hudson.security.AbstractPasswordBasedSecurityRealm
See Also:
SecurityRealm.createSecurityComponents()

doLogout

public void doLogout(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException

Overrides:
doLogout in class hudson.security.SecurityRealm
Throws:
IOException
javax.servlet.ServletException
See Also:
SecurityRealm.doLogout(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)

createFilter

public javax.servlet.Filter createFilter(javax.servlet.FilterConfig filterConfig)

Overrides:
createFilter in class hudson.security.SecurityRealm
See Also:
SecurityRealm.createFilter(javax.servlet.FilterConfig)

loadUserByUsername

public org.acegisecurity.userdetails.UserDetails loadUserByUsername(String username)
                                                             throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                                                    org.springframework.dao.DataAccessException

Specified by:
loadUserByUsername in interface org.acegisecurity.userdetails.UserDetailsService
Specified by:
loadUserByUsername in class hudson.security.AbstractPasswordBasedSecurityRealm
Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
See Also:
AbstractPasswordBasedSecurityRealm.loadUserByUsername(java.lang.String)

loadGroupByGroupname

public hudson.security.GroupDetails loadGroupByGroupname(String groupname)
                                                  throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                                         org.springframework.dao.DataAccessException

Specified by:
loadGroupByGroupname in class hudson.security.AbstractPasswordBasedSecurityRealm
Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
See Also:
SecurityRealm.loadGroupByGroupname(java.lang.String)

authenticate

protected org.acegisecurity.userdetails.UserDetails authenticate(String pUsername,
                                                                 String pPassword)
                                                          throws org.acegisecurity.AuthenticationException

Specified by:
authenticate in class hudson.security.AbstractPasswordBasedSecurityRealm
Throws:
org.acegisecurity.AuthenticationException
See Also:
AbstractPasswordBasedSecurityRealm.authenticate(java.lang.String, java.lang.String)


Copyright © 2004-2011 Hudson. All Rights Reserved.