Package org.jenkinsci.plugins
Class GitLabAuthenticationToken
java.lang.Object
org.acegisecurity.providers.AbstractAuthenticationToken
org.jenkinsci.plugins.GitLabAuthenticationToken
- All Implemented Interfaces:
Serializable
,Principal
,Authentication
- Author:
- mocleiri to hold the authentication token from the gitlab oauth process.
- See Also:
-
Constructor Summary
ConstructorDescriptionGitLabAuthenticationToken
(String accessToken, String gitlabServer, org.gitlab4j.api.Constants.TokenType tokenType) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Necessary for testingGets the OAuth access token, so that it can be persisted and used elsewhere.org.gitlab4j.api.GitLabApi
List
<org.gitlab4j.api.models.Project> getGroupProjects
(org.gitlab4j.api.models.Group group) org.gitlab4j.api.models.User
Returns the GHMyself object from this instance.Returns the login name in GitLab.getUserDetails
(String username) boolean
hasOrganizationPermission
(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.boolean
hasRepositoryPermission
(String repositoryName) boolean
isPublicRepository
(String repositoryName) listToNames
(Collection<org.gitlab4j.api.models.Project> repositories) org.gitlab4j.api.models.Group
loadOrganization
(String organization) org.gitlab4j.api.models.Project
loadRepository
(String repositoryName) org.gitlab4j.api.models.User
Methods inherited from class org.acegisecurity.providers.AbstractAuthenticationToken
equals, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.acegisecurity.Authentication
toSpring
-
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:
getAuthorities
in interfaceAuthentication
- Overrides:
getAuthorities
in classAbstractAuthenticationToken
-
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
-