Package org.jenkinsci.plugins
Class GitLabAuthenticationToken
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
org.jenkinsci.plugins.GitLabAuthenticationToken
- All Implemented Interfaces:
Serializable,Principal,org.springframework.security.core.Authentication,org.springframework.security.core.CredentialsContainer
public class GitLabAuthenticationToken
extends org.springframework.security.authentication.AbstractAuthenticationToken
- Author:
- mocleiri to hold the authentication token from the gitlab oauth process.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGitLabAuthenticationToken(String accessToken, String gitlabServer, org.gitlab4j.api.Constants.TokenType tokenType) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidNecessary for testingGets the OAuth access token, so that it can be persisted and used elsewhere.Collection<org.springframework.security.core.GrantedAuthority> org.gitlab4j.api.GitLabApiList<org.gitlab4j.api.models.Project> getGroupProjects(org.gitlab4j.api.models.Group group) org.gitlab4j.api.models.UserReturns the GHMyself object from this instance.Returns the login name in GitLab.getUserDetails(String username) booleanhasOrganizationPermission(String candidateName, String organization) For some reason I can't get the gitlab api to tell me for the current user the groups to which he belongs.booleanhasRepositoryPermission(String repositoryName) booleanisPublicRepository(String repositoryName) listToNames(Collection<org.gitlab4j.api.models.Project> repositories) org.gitlab4j.api.models.GrouploadOrganization(String organization) org.gitlab4j.api.models.ProjectloadRepository(String repositoryName) org.gitlab4j.api.models.UserMethods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
Method Details
-
clearCaches
public static void clearCaches()Necessary for testing -
getAccessToken
Gets the OAuth access token, so that it can be persisted and used elsewhere. -
getGitLabAPI
public org.gitlab4j.api.GitLabApi getGitLabAPI() -
getAuthorities
- Specified by:
getAuthoritiesin interfaceorg.springframework.security.core.Authentication- Overrides:
getAuthoritiesin classorg.springframework.security.authentication.AbstractAuthenticationToken
-
getCredentials
-
getPrincipal
Returns the login name in GitLab. -
getMyself
public org.gitlab4j.api.models.User getMyself()Returns the GHMyself object from this instance. -
hasOrganizationPermission
For some reason I can't get the gitlab api to tell me for the current user the groups to which he belongs. So this is a slightly larger consideration. If the authenticated user is part of any team within the organization then they have permission. It caches user organizations for 24 hours for faster web navigation.- Parameters:
candidateName-organization-- Returns:
- whether given candidate belongs to a given organization
-
hasRepositoryPermission
-
myRepositories
-
listToNames
-
isPublicRepository
-
loadUser
-
loadOrganization
-
loadRepository
-
getUserDetails
- Since:
- 0.21
-
getGroupProjects
-