Class GoogleOAuth2SecurityRealm
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<SecurityRealm>
-
- hudson.security.SecurityRealm
-
- org.jenkinsci.plugins.googlelogin.GoogleOAuth2SecurityRealm
-
- All Implemented Interfaces:
ExtensionPoint,Describable<SecurityRealm>
public class GoogleOAuth2SecurityRealm extends SecurityRealm
Login with Google using OpenID Connect / OAuth 2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGoogleOAuth2SecurityRealm.DescriptorImpl-
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
Constructors Constructor Description GoogleOAuth2SecurityRealm(String clientId, String clientSecret, String domain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecurityRealm.SecurityComponentscreateSecurityComponents()Acegi has this notion that first anAuthenticationobject is created by collecting user information and then the act of authentication is done later (byAuthenticationManager) to verify it.org.kohsuke.stapler.HttpResponsedoCommenceLogin(org.kohsuke.stapler.StaplerRequest request, String from, String referer)The login process starts from here.org.kohsuke.stapler.HttpResponsedoFinishLogin(org.kohsuke.stapler.StaplerRequest request)This is where the user comes back to at the end of the OpenID redirect ping-pong.StringgetClientId()SecretgetClientSecret()StringgetDomain()StringgetLoginUrl()Login begins with ourdoCommenceLogin(StaplerRequest, String,String)method.protected StringgetPostLogOutUrl(org.kohsuke.stapler.StaplerRequest req, Authentication auth)booleanisRootURLFromRequest()voidsetRootURLFromRequest(boolean rootURLFromRequest)-
Methods inherited from class hudson.security.SecurityRealm
all, allowsSignup, canLogOut, commenceSignup, commonFilters, createCliAuthenticator, createFilter, doCaptcha, doLogout, getAuthenticationGatewayUrl, getCaptchaSupport, getCaptchaSupportDescriptors, getDescriptor, getFrom, getGroupIdStrategy, getPostLogOutUrl2, getSecurityComponents, getUserIdStrategy, loadGroupByGroupname, loadGroupByGroupname, loadGroupByGroupname2, loadUserByUsername, loadUserByUsername2, setCaptchaSupport, validateCaptcha
-
-
-
-
Constructor Detail
-
GoogleOAuth2SecurityRealm
@DataBoundConstructor public GoogleOAuth2SecurityRealm(String clientId, String clientSecret, String domain) throws IOException
- Throws:
IOException
-
-
Method Detail
-
isRootURLFromRequest
public boolean isRootURLFromRequest()
-
setRootURLFromRequest
@DataBoundSetter public void setRootURLFromRequest(boolean rootURLFromRequest)
-
getClientId
public String getClientId()
-
getClientSecret
public Secret getClientSecret()
-
getDomain
public String getDomain()
-
getLoginUrl
public String getLoginUrl()
Login begins with ourdoCommenceLogin(StaplerRequest, String,String)method.- Overrides:
getLoginUrlin classSecurityRealm
-
createSecurityComponents
public SecurityRealm.SecurityComponents createSecurityComponents()
Acegi has this notion that first anAuthenticationobject is created by collecting user information and then the act of authentication is done later (byAuthenticationManager) to verify it. But in case of OpenID, we create anAuthenticationonly after we verified the user identity, soAuthenticationManagerbecomes no-op.- Specified by:
createSecurityComponentsin classSecurityRealm
-
getPostLogOutUrl
protected String getPostLogOutUrl(org.kohsuke.stapler.StaplerRequest req, Authentication auth)
- Overrides:
getPostLogOutUrlin classSecurityRealm
-
doCommenceLogin
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public org.kohsuke.stapler.HttpResponse doCommenceLogin(org.kohsuke.stapler.StaplerRequest request, @QueryParameter String from, @Header("Referer") String referer) throws IOExceptionThe login process starts from here.- Throws:
IOException
-
doFinishLogin
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public org.kohsuke.stapler.HttpResponse doFinishLogin(org.kohsuke.stapler.StaplerRequest request) throws IOExceptionThis is where the user comes back to at the end of the OpenID redirect ping-pong.- Throws:
IOException
-
-