Package org.jenkinsci.plugins
Class GitLabSecurityRealm
java.lang.Object
hudson.model.AbstractDescribableImpl<SecurityRealm>
hudson.security.SecurityRealm
org.jenkinsci.plugins.GitLabSecurityRealm
- All Implemented Interfaces:
ExtensionPoint
,Describable<SecurityRealm>
Implementation of the AbstractPasswordBasedSecurityRealm that uses gitlab
oauth to verify the user can login.
This is based on the GitLabSecurityRealm from the gitlab-auth-plugin written
by Alex Ackerman.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
Nested classes/interfaces inherited from class hudson.security.SecurityRealm
SecurityRealm.SecurityComponents
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class hudson.security.SecurityRealm
AUTHENTICATED_AUTHORITY, AUTHENTICATED_AUTHORITY2, LIST, NO_AUTHENTICATION
-
Constructor Summary
ConstructorsConstructorDescriptionGitLabSecurityRealm
(String gitlabWebUri, String gitlabApiUri, String clientID, String clientSecret) -
Method Summary
Modifier and TypeMethodDescriptionboolean
org.kohsuke.stapler.HttpResponse
doCommenceLogin
(org.kohsuke.stapler.StaplerRequest2 request, String from, String referer) org.kohsuke.stapler.HttpResponse
doFinishLogin
(org.kohsuke.stapler.StaplerRequest2 request) This is where the user comes back to at the end of the OpenID redirect ping-pong.boolean
Compare an object against this instance for equivalence.Used by jellyprotected String
getPostLogOutUrl2
(org.kohsuke.stapler.StaplerRequest2 req, org.springframework.security.core.Authentication auth) int
hashCode()
loadGroupByGroupname2
(String groupName, boolean fetchMembers) org.springframework.security.core.userdetails.UserDetails
loadUserByUsername2
(String username) Methods inherited from class hudson.security.SecurityRealm
all, canLogOut, commenceSignup, commonFilters, createCliAuthenticator, createFilter, createFilter, doCaptcha, doLogout, doLogout, getAuthenticationGatewayUrl, getCaptchaSupport, getCaptchaSupportDescriptors, getFrom, getGroupIdStrategy, getPostLogOutUrl, getPostLogOutUrl2, getSecurityComponents, getUserIdStrategy, loadGroupByGroupname, loadGroupByGroupname, loadUserByUsername, setCaptchaSupport, validateCaptcha
-
Constructor Details
-
GitLabSecurityRealm
@DataBoundConstructor public GitLabSecurityRealm(String gitlabWebUri, String gitlabApiUri, String clientID, String clientSecret) - Parameters:
gitlabWebUri
- The URI to the root of the web UI for GitLab or GitLab Enterprise, including the protocol (e.g. https).gitlabApiUri
- The URI to the root of the API for GitLab or GitLab Enterprise, including the protocol (e.g. https).clientID
- The client ID for the created OAuth Application.clientSecret
- The client secret for the created GitLab OAuth Application. Should be encrypted value of aSecret
, for compatibility also plain text values are accepted.
-
-
Method Details
-
getGitlabApiUri
- Returns:
- the URI to the API root of GitLab or GitLab Enterprise.
-
getGitlabWebUri
- Returns:
- the uri to the web root of GitLab (varies for GitLab Enterprise Edition)
-
getClientID
- Returns:
- the clientID
-
getClientSecret
Used by jelly- Returns:
- the client secret
-
doCommenceLogin
public org.kohsuke.stapler.HttpResponse doCommenceLogin(org.kohsuke.stapler.StaplerRequest2 request, @QueryParameter String from, @Header("Referer") String referer) throws IOException - Throws:
IOException
-
doFinishLogin
public org.kohsuke.stapler.HttpResponse doFinishLogin(org.kohsuke.stapler.StaplerRequest2 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 classSecurityRealm
-
createSecurityComponents
- Specified by:
createSecurityComponents
in classSecurityRealm
-
getLoginUrl
- Overrides:
getLoginUrl
in classSecurityRealm
-
getPostLogOutUrl2
protected String getPostLogOutUrl2(org.kohsuke.stapler.StaplerRequest2 req, org.springframework.security.core.Authentication auth) - Overrides:
getPostLogOutUrl2
in classSecurityRealm
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<SecurityRealm>
- Overrides:
getDescriptor
in classSecurityRealm
-
loadUserByUsername2
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername2(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException - Overrides:
loadUserByUsername2
in classSecurityRealm
- Parameters:
username
-- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
equals
Compare an object against this instance for equivalence. -
hashCode
public int hashCode() -
loadGroupByGroupname2
public GroupDetails loadGroupByGroupname2(String groupName, boolean fetchMembers) throws org.springframework.security.core.userdetails.UsernameNotFoundException - Overrides:
loadGroupByGroupname2
in classSecurityRealm
- Parameters:
groupName
-- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-