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>
Login with OpenID Connect / OAuth 2
- Author:
 - Michael Bischoff, Steve Arch
 
- 
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, Secret clientSecret, OicServerConfiguration serverConfiguration, Boolean disableSslVerification, IdStrategy userIdStrategy, IdStrategy groupIdStrategy)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected org.pac4j.oidc.client.OidcClientprotected static io.burt.jmespath.Expression<Object>compileJMESPath(String str, String logComment) jakarta.servlet.FiltercreateFilter(jakarta.servlet.FilterConfig filterConfig) voidvoiddoCommenceLogin(String from, String referer) Handles the securityRealm/commenceLogin resource and sends the user off to the IdPvoiddoFinishLogin(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) This is where the user comes back to at the end of the OpenID redirect ping-pong.voiddoLogout(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) getPostLogOutUrl2(org.kohsuke.stapler.StaplerRequest2 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(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse) Handles Token Expiration.booleanbooleanbooleanisExpired(OicCredentials credentials) booleanbooleanbooleanbooleanbooleanprotected ObjectvoidsetAllowTokenAccessWithoutOicSession(boolean allowTokenAccessWithoutOicSession) voidsetEmailFieldName(String emailFieldName) voidsetEscapeHatchSecret(Secret escapeHatchSecret) voidsetFullNameFieldName(String fullNameFieldName) voidsetGroupsFieldName(String groupsFieldName) voidsetLogoutFromOpenidProvider(boolean logoutFromOpenidProvider) voidsetPostLogoutRedirectUrl(String postLogoutRedirectUrl) voidsetProperties(List<OidcProperty> properties) voidsetRootURLFromRequest(boolean rootURLFromRequest) voidsetSendScopesInTokenRequest(boolean sendScopesInTokenRequest) voidsetTokenExpirationCheckDisabled(boolean tokenExpirationCheckDisabled) voidsetTokenFieldToCheckKey(String tokenFieldToCheckKey) voidsetTokenFieldToCheckValue(String tokenFieldToCheckValue) voidsetUserNameField(String userNameField) Methods inherited from class hudson.security.SecurityRealm
all, allowsSignup, canLogOut, commenceSignup, commonFilters, createCliAuthenticator, createFilter, doCaptcha, doLogout, getCaptchaSupport, getCaptchaSupportDescriptors, getDescriptor, getFrom, getPostLogOutUrl, getPostLogOutUrl2, getSecurityComponents, loadGroupByGroupname, loadGroupByGroupname, loadGroupByGroupname2, loadUserByUsername, loadUserByUsername2, setCaptchaSupport, validateCaptcha 
- 
Constructor Details
- 
OicSecurityRealm
@DataBoundConstructor public OicSecurityRealm(String clientId, Secret clientSecret, OicServerConfiguration serverConfiguration, Boolean disableSslVerification, IdStrategy userIdStrategy, IdStrategy groupIdStrategy) throws IOException, Descriptor.FormException - Throws:
 IOExceptionDescriptor.FormException
 
 - 
 - 
Method Details
- 
readResolve
- Throws:
 ObjectStreamException
 - 
getClientId
 - 
getClientSecret
 - 
getServerConfiguration
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public OicServerConfiguration getServerConfiguration() - 
getUserNameField
 - 
isMissingIdStrategy
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isMissingIdStrategy() - 
getUserIdStrategy
- Overrides:
 getUserIdStrategyin classSecurityRealm
 - 
getTokenFieldToCheckKey
 - 
getTokenFieldToCheckValue
 - 
getFullNameFieldName
 - 
getEmailFieldName
 - 
getGroupsFieldName
 - 
getGroupIdStrategy
- Overrides:
 getGroupIdStrategyin classSecurityRealm
 - 
isDisableSslVerification
public boolean isDisableSslVerification() - 
isLogoutFromOpenidProvider
public boolean isLogoutFromOpenidProvider() - 
getPostLogoutRedirectUrl
 - 
isRootURLFromRequest
public boolean isRootURLFromRequest() - 
isSendScopesInTokenRequest
public boolean isSendScopesInTokenRequest() - 
isTokenExpirationCheckDisabled
public boolean isTokenExpirationCheckDisabled() - 
isAllowTokenAccessWithoutOicSession
public boolean isAllowTokenAccessWithoutOicSession() - 
getProperties
 - 
setProperties
- Throws:
 IOException
 - 
createProxyAwareResourceRetriver
@PostConstruct @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void createProxyAwareResourceRetriver() - 
buildOidcClient
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) protected org.pac4j.oidc.client.OidcClient buildOidcClient() - 
setUserNameField
 - 
setTokenFieldToCheckKey
 - 
setTokenFieldToCheckValue
 - 
setFullNameFieldName
 - 
setEmailFieldName
 - 
compileJMESPath
 - 
setGroupsFieldName
 - 
setLogoutFromOpenidProvider
@DataBoundSetter public void setLogoutFromOpenidProvider(boolean logoutFromOpenidProvider)  - 
setPostLogoutRedirectUrl
 - 
setEscapeHatchSecret
 - 
setRootURLFromRequest
@DataBoundSetter public void setRootURLFromRequest(boolean rootURLFromRequest)  - 
setSendScopesInTokenRequest
@DataBoundSetter public void setSendScopesInTokenRequest(boolean sendScopesInTokenRequest)  - 
setTokenExpirationCheckDisabled
@DataBoundSetter public void setTokenExpirationCheckDisabled(boolean tokenExpirationCheckDisabled)  - 
setAllowTokenAccessWithoutOicSession
@DataBoundSetter public void setAllowTokenAccessWithoutOicSession(boolean allowTokenAccessWithoutOicSession)  - 
getLoginUrl
- Overrides:
 getLoginUrlin classSecurityRealm
 - 
getAuthenticationGatewayUrl
- Overrides:
 getAuthenticationGatewayUrlin classSecurityRealm
 - 
createFilter
public jakarta.servlet.Filter createFilter(jakarta.servlet.FilterConfig filterConfig) - Overrides:
 createFilterin classSecurityRealm
 - 
createSecurityComponents
- Specified by:
 createSecurityComponentsin classSecurityRealm
 - 
getValidRedirectUrl
Validate post-login redirect URL For security reasons, the login must not redirect outside Jenkins realm. For usability reason, the logout page should redirect to root url. - 
doCommenceLogin
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doCommenceLogin(@QueryParameter String from, @Header("Referer") String referer) throws URISyntaxException Handles 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)- Throws:
 URISyntaxException- if the provided data is invalid
 - 
getStringField
 - 
doLogout
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doLogout(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Overrides:
 doLogoutin classSecurityRealm- Throws:
 IOExceptionjakarta.servlet.ServletException
 - 
getPostLogOutUrl2
public String getPostLogOutUrl2(org.kohsuke.stapler.StaplerRequest2 req, org.springframework.security.core.Authentication auth) - Overrides:
 getPostLogOutUrl2in classSecurityRealm
 - 
doFinishLogin
public void doFinishLogin(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws IOException, ParseException This is where the user comes back to at the end of the OpenID redirect ping-pong.- Parameters:
 request- The user's request- Throws:
 ParseException- if the JWT (or other response) could not be parsed.IOException
 - 
handleTokenExpiration
public boolean handleTokenExpiration(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse) throws IOException Handles Token Expiration.- Throws:
 IOException- a low level exception
 - 
isExpired
 
 -