de.theit.jenkins.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.jenkins.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 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 cookieDomain
          A domain to use when setting cookies, overriding the SSO Domain set in Crowd (since Crowd 2.5.2).
 String cookieTokenkey
          SSO cookie name for application.
 String group
          Contains the Crowd group to which a user must belong to.
 String httpMaxConnections
           
 String httpProxyHost
           
 String httpProxyPassword
           
 String httpProxyPort
           
 String httpProxyUsername
           
 String httpTimeout
           
 boolean nestedGroups
          Specifies whether nested groups can be used.
 String password
          Contains the application password to access Crowd.
 int sessionValidationInterval
          The number of minutes to cache authentication validation in the session.
 String socketTimeout
           
 String url
          Contains the Crowd server URL.
 Boolean useProxy
           
 boolean useSSO
          Don't use SSO, only REST API authentication.
 
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, int sessionValidationInterval, boolean useSSO, String cookieDomain, String cookieTokenkey, Boolean useProxy, String httpProxyHost, String httpProxyPort, String httpProxyUsername, String httpProxyPassword, String socketTimeout, String httpTimeout, String httpMaxConnections)
          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, getCaptchaSupport, getCaptchaSupportDescriptors, getDescriptor, getLoginUrl, getPostLogOutUrl, getSecurityComponents, setCaptchaSupport, 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.


useSSO

public final boolean useSSO
Don't use SSO, only REST API authentication.


sessionValidationInterval

public final int sessionValidationInterval
The number of minutes to cache authentication validation in the session. If this value is set to 0, each HTTP request will be authenticated with the Crowd server.


cookieDomain

public final String cookieDomain
A domain to use when setting cookies, overriding the SSO Domain set in Crowd (since Crowd 2.5.2). cookie.domain details


cookieTokenkey

public final String cookieTokenkey
SSO cookie name for application. cookie.tokenkey details


useProxy

public final Boolean useProxy

httpProxyHost

public final String httpProxyHost

httpProxyPort

public final String httpProxyPort

httpProxyUsername

public final String httpProxyUsername

httpProxyPassword

public final String httpProxyPassword

socketTimeout

public final String socketTimeout

httpTimeout

public final String httpTimeout

httpMaxConnections

public final String httpMaxConnections
Constructor Detail

CrowdSecurityRealm

@DataBoundConstructor
public CrowdSecurityRealm(String url,
                                               String applicationName,
                                               String password,
                                               String group,
                                               boolean nestedGroups,
                                               int sessionValidationInterval,
                                               boolean useSSO,
                                               String cookieDomain,
                                               String cookieTokenkey,
                                               Boolean useProxy,
                                               String httpProxyHost,
                                               String httpProxyPort,
                                               String httpProxyUsername,
                                               String httpProxyPassword,
                                               String socketTimeout,
                                               String httpTimeout,
                                               String httpMaxConnections)
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.
sessionValidationInterval - The number of minutes to cache authentication validation in the session. If this value is set to 0, each HTTP request will be authenticated with the Crowd server.
useSSO - Enable SSO authentication.
cookieDomain -
cookieTokenkey -
useProxy -
httpProxyHost -
httpProxyPort -
httpProxyUsername -
httpProxyPassword -
socketTimeout -
httpTimeout -
httpMaxConnections -
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-2014. All Rights Reserved.