org.jenkinsci.plugins
Class GithubSecurityRealm

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<hudson.security.SecurityRealm>
      extended by hudson.security.SecurityRealm
          extended by org.jenkinsci.plugins.GithubSecurityRealm
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.security.SecurityRealm>

public class GithubSecurityRealm
extends hudson.security.SecurityRealm

Implementation of the AbstractPasswordBasedSecurityRealm that uses github oauth to verify the user can login. This is based on the MySQLSecurityRealm from the mysql-auth-plugin written by Alex Ackerman.


Nested Class Summary
static class GithubSecurityRealm.DescriptorImpl
           
 
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
 
Fields inherited from class hudson.security.SecurityRealm
AUTHENTICATED_AUTHORITY, LIST, NO_AUTHENTICATION
 
Constructor Summary
GithubSecurityRealm(String githubUri, String clientID, String clientSecret)
           
 
Method Summary
 boolean allowsSignup()
           
 hudson.security.SecurityRealm.SecurityComponents createSecurityComponents()
           
 org.kohsuke.stapler.HttpResponse doCommenceLogin(String referer)
           
 org.kohsuke.stapler.HttpResponse doFinishLogin(org.kohsuke.stapler.StaplerRequest request)
          This is where the user comes back to at the end of the OpenID redirect ping-pong.
 String getClientID()
           
 String getClientSecret()
           
 String getGithubUri()
           
 String getLoginUrl()
           
 hudson.security.GroupDetails loadGroupByGroupname(String groupname)
           
 org.acegisecurity.userdetails.UserDetails loadUserByUsername(String username)
           
 
Methods inherited from class hudson.security.SecurityRealm
all, canLogOut, commenceSignup, createCliAuthenticator, createFilter, doCaptcha, doLogout, findBean, getAuthenticationGatewayUrl, getCaptchaSupport, getCaptchaSupportDescriptors, getDescriptor, getPostLogOutUrl, getSecurityComponents, setCaptchaSupport, validateCaptcha
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GithubSecurityRealm

@DataBoundConstructor
public GithubSecurityRealm(String githubUri,
                                                String clientID,
                                                String clientSecret)
Method Detail

getGithubUri

public String getGithubUri()
Returns:
the uri to Github (varies for Github Enterprise Edition)

getClientID

public String getClientID()
Returns:
the clientID

getClientSecret

public String getClientSecret()
Returns:
the clientSecret

doCommenceLogin

public org.kohsuke.stapler.HttpResponse doCommenceLogin(@Header(value="Referer")
                                                        String referer)
                                                 throws IOException
Throws:
IOException

doFinishLogin

public org.kohsuke.stapler.HttpResponse doFinishLogin(org.kohsuke.stapler.StaplerRequest request)
                                               throws IOException
This is where the user comes back to at the end of the OpenID redirect ping-pong.

Throws:
IOException

allowsSignup

public boolean allowsSignup()
Overrides:
allowsSignup in class hudson.security.SecurityRealm

createSecurityComponents

public hudson.security.SecurityRealm.SecurityComponents createSecurityComponents()
Specified by:
createSecurityComponents in class hudson.security.SecurityRealm

getLoginUrl

public String getLoginUrl()
Overrides:
getLoginUrl in class hudson.security.SecurityRealm

loadUserByUsername

public org.acegisecurity.userdetails.UserDetails loadUserByUsername(String username)
                                                             throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                                                    org.springframework.dao.DataAccessException
Overrides:
loadUserByUsername in class hudson.security.SecurityRealm
Parameters:
username -
Returns:
Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException

loadGroupByGroupname

public hudson.security.GroupDetails loadGroupByGroupname(String groupname)
                                                  throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                                         org.springframework.dao.DataAccessException
Overrides:
loadGroupByGroupname in class hudson.security.SecurityRealm
Parameters:
groupname -
Returns:
Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException


Copyright © 2004-2011. All Rights Reserved.