Package org.jenkinsci.plugins.oic
Class OicSecurityRealm
java.lang.Object
hudson.model.AbstractDescribableImpl<SecurityRealm>
hudson.security.SecurityRealm
org.jenkinsci.plugins.oic.OicSecurityRealm
- All Implemented Interfaces:
ExtensionPoint,Describable<SecurityRealm>,Serializable
Login with OpenID Connect / OAuth 2
- Author:
- Michael Bischoff, Steve Arch
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enumNested classes/interfaces inherited from class hudson.security.SecurityRealm
SecurityRealm.SecurityComponentsNested 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
ConstructorsConstructorDescriptionOicSecurityRealm(String clientId, String clientSecret, String authorizationServerUrl, String tokenServerUrl, String jwksServerUrl, String tokenAuthMethod, String userInfoServerUrl, String endSessionEndpoint, String scopes, String automanualconfigure, Boolean disableSslVerification, Boolean useRefreshTokens) OicSecurityRealm(String clientId, String clientSecret, String wellKnownOpenIDConfigurationUrl, String tokenServerUrl, String jwksServerUrl, String tokenAuthMethod, String authorizationServerUrl, String userInfoServerUrl, String userNameField, String tokenFieldToCheckKey, String tokenFieldToCheckValue, String fullNameFieldName, String emailFieldName, String scopes, String groupsFieldName, Boolean disableSslVerification, Boolean logoutFromOpenidProvider, String endSessionEndpoint, String postLogoutRedirectUrl, Boolean escapeHatchEnabled, String escapeHatchUsername, String escapeHatchSecret, String escapeHatchGroup, String automanualconfigure) Deprecated.retained for backwards binary compatibility. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.api.client.auth.oauth2.AuthorizationCodeFlowBuild authorization code flowprotected booleancheckEscapeHatch(String username, String password) protected static io.burt.jmespath.Expression<Object>compileJMESPath(String str, String logComment) javax.servlet.FiltercreateFilter(javax.servlet.FilterConfig filterConfig) org.kohsuke.stapler.HttpResponsedoCommenceLogin(String from, String referer) Handles the the securityRealm/commenceLogin resource and sends the user off to the IdPorg.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.voiddoLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) getPostLogOutUrl2(org.kohsuke.stapler.StaplerRequest req, org.springframework.security.core.Authentication auth) protected StringgetStringField(Object object, io.burt.jmespath.Expression<Object> fieldExpr) protected StringValidate post-login redirect URL For security reasons, the login must not redirect outside Jenkins realm.booleanhandleTokenExpiration(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) Handles Token Expiration.booleanbooleanbooleanbooleanbooleanbooleanisExpired(OicCredentials credentials) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanprotected ObjectvoidsetAllowedTokenExpirationClockSkewSeconds(Long allowedTokenExpirationClockSkewSeconds) voidsetAllowTokenAccessWithoutOicSession(boolean allowTokenAccessWithoutOicSession) voidsetDisableTokenVerification(boolean disableTokenVerification) voidsetEmailFieldName(String emailFieldName) voidsetEscapeHatchEnabled(boolean escapeHatchEnabled) voidsetEscapeHatchGroup(String escapeHatchGroup) voidsetEscapeHatchSecret(Secret escapeHatchSecret) voidsetEscapeHatchUsername(String escapeHatchUsername) voidsetFullNameFieldName(String fullNameFieldName) voidsetGroupsFieldName(String groupsFieldName) voidsetLogoutFromOpenidProvider(boolean logoutFromOpenidProvider) voidsetNonceDisabled(boolean nonceDisabled) voidsetOverrideScopes(String overrideScopes) voidsetOverrideScopesDefined(boolean overrideScopesDefined) voidsetPkceEnabled(boolean pkceEnabled) voidsetPostLogoutRedirectUrl(String postLogoutRedirectUrl) voidsetRootURLFromRequest(boolean rootURLFromRequest) voidvoidsetSendScopesInTokenRequest(boolean sendScopesInTokenRequest) voidsetTokenExpirationCheckDisabled(boolean tokenExpirationCheckDisabled) voidsetTokenFieldToCheckKey(String tokenFieldToCheckKey) voidsetTokenFieldToCheckValue(String tokenFieldToCheckValue) voidsetUserNameField(String userNameField) voidsetWellKnownOpenIDConfigurationUrl(String wellKnownOpenIDConfigurationUrl) Methods inherited from class hudson.security.SecurityRealm
all, allowsSignup, canLogOut, commenceSignup, commonFilters, createCliAuthenticator, doCaptcha, getCaptchaSupport, getCaptchaSupportDescriptors, getDescriptor, getFrom, getGroupIdStrategy, getPostLogOutUrl, getSecurityComponents, getUserIdStrategy, loadGroupByGroupname, loadGroupByGroupname, loadGroupByGroupname2, loadUserByUsername, loadUserByUsername2, setCaptchaSupport, validateCaptcha
-
Constructor Details
-
OicSecurityRealm
@Deprecated public OicSecurityRealm(String clientId, String clientSecret, String wellKnownOpenIDConfigurationUrl, String tokenServerUrl, String jwksServerUrl, String tokenAuthMethod, String authorizationServerUrl, String userInfoServerUrl, String userNameField, String tokenFieldToCheckKey, String tokenFieldToCheckValue, String fullNameFieldName, String emailFieldName, String scopes, String groupsFieldName, Boolean disableSslVerification, Boolean logoutFromOpenidProvider, String endSessionEndpoint, String postLogoutRedirectUrl, Boolean escapeHatchEnabled, String escapeHatchUsername, String escapeHatchSecret, String escapeHatchGroup, String automanualconfigure) throws IOException Deprecated.retained for backwards binary compatibility.- Throws:
IOException
-
OicSecurityRealm
@DataBoundConstructor public OicSecurityRealm(String clientId, String clientSecret, String authorizationServerUrl, String tokenServerUrl, String jwksServerUrl, String tokenAuthMethod, String userInfoServerUrl, String endSessionEndpoint, String scopes, String automanualconfigure, Boolean disableSslVerification, Boolean useRefreshTokens) throws IOException - Throws:
IOException
-
-
Method Details
-
readResolve
-
getClientId
-
getClientSecret
-
getWellKnownOpenIDConfigurationUrl
-
getTokenServerUrl
-
getJwksServerUrl
-
getTokenAuthMethod
-
getAuthorizationServerUrl
-
getUserInfoServerUrl
-
getUserNameField
-
getTokenFieldToCheckKey
-
getTokenFieldToCheckValue
-
getFullNameFieldName
-
getEmailFieldName
-
getGroupsFieldName
-
getScopes
-
isDisableSslVerification
public boolean isDisableSslVerification() -
isLogoutFromOpenidProvider
public boolean isLogoutFromOpenidProvider() -
getEndSessionEndpoint
-
getPostLogoutRedirectUrl
-
isEscapeHatchEnabled
public boolean isEscapeHatchEnabled() -
getEscapeHatchUsername
-
getEscapeHatchSecret
-
getEscapeHatchGroup
-
getAutomanualconfigure
-
isUseRefreshTokens
public boolean isUseRefreshTokens() -
isOverrideScopesDefined
public boolean isOverrideScopesDefined() -
getOverrideScopes
-
isRootURLFromRequest
public boolean isRootURLFromRequest() -
isSendScopesInTokenRequest
public boolean isSendScopesInTokenRequest() -
isPkceEnabled
public boolean isPkceEnabled() -
isDisableTokenVerification
public boolean isDisableTokenVerification() -
isNonceDisabled
public boolean isNonceDisabled() -
isTokenExpirationCheckDisabled
public boolean isTokenExpirationCheckDisabled() -
isAllowTokenAccessWithoutOicSession
public boolean isAllowTokenAccessWithoutOicSession() -
getAllowedTokenExpirationClockSkewSeconds
-
isAutoConfigure
public boolean isAutoConfigure() -
setWellKnownOpenIDConfigurationUrl
@DataBoundSetter public void setWellKnownOpenIDConfigurationUrl(String wellKnownOpenIDConfigurationUrl) -
setUserNameField
-
setTokenFieldToCheckKey
-
setTokenFieldToCheckValue
-
setFullNameFieldName
-
setEmailFieldName
-
compileJMESPath
-
setGroupsFieldName
-
setScopes
-
setLogoutFromOpenidProvider
@DataBoundSetter public void setLogoutFromOpenidProvider(boolean logoutFromOpenidProvider) -
setPostLogoutRedirectUrl
-
setEscapeHatchEnabled
@DataBoundSetter public void setEscapeHatchEnabled(boolean escapeHatchEnabled) -
setEscapeHatchUsername
-
setEscapeHatchSecret
-
checkEscapeHatch
-
setEscapeHatchGroup
-
setOverrideScopesDefined
@DataBoundSetter public void setOverrideScopesDefined(boolean overrideScopesDefined) -
setOverrideScopes
-
setRootURLFromRequest
@DataBoundSetter public void setRootURLFromRequest(boolean rootURLFromRequest) -
setSendScopesInTokenRequest
@DataBoundSetter public void setSendScopesInTokenRequest(boolean sendScopesInTokenRequest) -
setPkceEnabled
@DataBoundSetter public void setPkceEnabled(boolean pkceEnabled) -
setDisableTokenVerification
@DataBoundSetter public void setDisableTokenVerification(boolean disableTokenVerification) -
setNonceDisabled
@DataBoundSetter public void setNonceDisabled(boolean nonceDisabled) -
setTokenExpirationCheckDisabled
@DataBoundSetter public void setTokenExpirationCheckDisabled(boolean tokenExpirationCheckDisabled) -
setAllowTokenAccessWithoutOicSession
@DataBoundSetter public void setAllowTokenAccessWithoutOicSession(boolean allowTokenAccessWithoutOicSession) -
setAllowedTokenExpirationClockSkewSeconds
@DataBoundSetter public void setAllowedTokenExpirationClockSkewSeconds(Long allowedTokenExpirationClockSkewSeconds) -
getLoginUrl
- Overrides:
getLoginUrlin classSecurityRealm
-
getAuthenticationGatewayUrl
- Overrides:
getAuthenticationGatewayUrlin classSecurityRealm
-
createFilter
public javax.servlet.Filter createFilter(javax.servlet.FilterConfig filterConfig) - Overrides:
createFilterin classSecurityRealm
-
createSecurityComponents
- Specified by:
createSecurityComponentsin classSecurityRealm
-
buildAuthorizationCodeFlow
protected com.google.api.client.auth.oauth2.AuthorizationCodeFlow buildAuthorizationCodeFlow()Build authorization code flow -
getValidRedirectUrl
Validate post-login redirect URL For security reasons, the login must not redirect outside Jenkins realm. For useablility reason, the logout page should redirect to root url. -
doCommenceLogin
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public org.kohsuke.stapler.HttpResponse doCommenceLogin(@QueryParameter String from, @Header("Referer") String referer) Handles the the securityRealm/commenceLogin resource and sends the user off to the IdP- Parameters:
from- the relative URL to the page that the user has just come fromreferer- the HTTP referer header (where to redirect the user back to after login has finished)- Returns:
- an
HttpResponseobject
-
getStringField
-
doLogout
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException - Overrides:
doLogoutin classSecurityRealm- Throws:
IOExceptionjavax.servlet.ServletException
-
getPostLogOutUrl2
public String getPostLogOutUrl2(org.kohsuke.stapler.StaplerRequest req, org.springframework.security.core.Authentication auth) - Overrides:
getPostLogOutUrl2in classSecurityRealm
-
doFinishLogin
public org.kohsuke.stapler.HttpResponse doFinishLogin(org.kohsuke.stapler.StaplerRequest request) throws IOException This is where the user comes back to at the end of the OpenID redirect ping-pong.- Parameters:
request- The user's request- Returns:
- an HttpResponse
- Throws:
IOException
-
handleTokenExpiration
public boolean handleTokenExpiration(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws IOException, javax.servlet.ServletException Handles Token Expiration.- Throws:
IOException- a low level exceptionjavax.servlet.ServletException
-
isExpired
-