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.ConverterImpl
           
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 githubWebUri, String clientID, String clientSecret)
          Deprecated. Use GithubSecurityRealm(String, String, String, String) instead.
GithubSecurityRealm(String githubWebUri, String githubApiUri, String clientID, String clientSecret)
           
 
Method Summary
 boolean allowsSignup()
           
 hudson.security.SecurityRealm.SecurityComponents createSecurityComponents()
           
 org.kohsuke.stapler.HttpResponse doCommenceLogin(org.kohsuke.stapler.StaplerRequest request, 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 getGithubApiUri()
           
 String getGithubUri()
          Deprecated. use getGithubWebUri() instead.
 String getGithubWebUri()
           
 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 githubWebUri,
                                                String githubApiUri,
                                                String clientID,
                                                String clientSecret)
Parameters:
githubWebUri - The URI to the root of the web UI for GitHub or GitHub Enterprise, including the protocol (e.g. https).
githubApiUri - The URI to the root of the API for GitHub or GitHub Enterprise, including the protocol (e.g. https).
clientID - The client ID for the created OAuth Application.
clientSecret - The client secret for the created GitHub OAuth Application.

GithubSecurityRealm

@Deprecated
public GithubSecurityRealm(String githubWebUri,
                                      String clientID,
                                      String clientSecret)
Deprecated. Use GithubSecurityRealm(String, String, String, String) instead.

Parameters:
githubWebUri - The URI to the root of the web UI for GitHub or GitHub Enterprise.
clientID - The client ID for the created OAuth Application.
clientSecret - The client secret for the created GitHub OAuth Application.
Method Detail

getGithubApiUri

public String getGithubApiUri()
Returns:
the URI to the API root of GitHub or GitHub Enterprise.

getGithubWebUri

public String getGithubWebUri()
Returns:
the uri to the web root of Github (varies for Github Enterprise Edition)

getGithubUri

@Deprecated
public String getGithubUri()
Deprecated. use getGithubWebUri() instead.

Returns:
the uri to the web root of 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(org.kohsuke.stapler.StaplerRequest request,
                                                        @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-2014. All Rights Reserved.