org.jenkinsci.plugins
Class GithubAuthenticationToken
java.lang.Object
org.acegisecurity.providers.AbstractAuthenticationToken
org.jenkinsci.plugins.GithubAuthenticationToken
- All Implemented Interfaces:
- Serializable, Principal, org.acegisecurity.Authentication
public class GithubAuthenticationToken
- extends org.acegisecurity.providers.AbstractAuthenticationToken
- Author:
- mocleiri
to hold the authentication token from the github oauth process.
- See Also:
- Serialized Form
| Methods inherited from class org.acegisecurity.providers.AbstractAuthenticationToken |
equals, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString |
GithubAuthenticationToken
public GithubAuthenticationToken(String accessToken,
String githubServer)
throws IOException
- Throws:
IOException
getAccessToken
public String getAccessToken()
- Gets the OAuth access token, so that it can be persisted and used elsewhere.
getGitHub
public org.kohsuke.github.GitHub getGitHub()
getAuthorities
public org.acegisecurity.GrantedAuthority[] getAuthorities()
- Specified by:
getAuthorities in interface org.acegisecurity.Authentication- Overrides:
getAuthorities in class org.acegisecurity.providers.AbstractAuthenticationToken
getCredentials
public Object getCredentials()
getPrincipal
public String getPrincipal()
- Returns the login name in GitHub.
hasOrganizationPermission
public boolean hasOrganizationPermission(String candidateName,
String organization)
- For some reason I can't get the github 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.
- Parameters:
candidateName - organization -
- Returns:
loadUser
public org.kohsuke.github.GHUser loadUser(String username)
throws IOException
- Throws:
IOException
loadOrganization
public org.kohsuke.github.GHOrganization loadOrganization(String organization)
throws IOException
- Throws:
IOException
loadTeam
public org.kohsuke.github.GHTeam loadTeam(String organization,
String team)
throws IOException
- Throws:
IOException
Copyright © 2004-2012. All Rights Reserved.