Class PluginImpl
- java.lang.Object
-
- hudson.model.Descriptor<GlobalConfiguration>
-
- jenkins.model.GlobalConfiguration
-
- com.sonymobile.jenkins.plugins.kerberossso.PluginImpl
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<GlobalConfiguration>
,Saveable
,OnMaster
@Extension @Symbol("kerberosSso") @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class PluginImpl extends GlobalConfiguration
The core of this Plugin. Handles the configuration of theKerberosSSOFilter
It also starts / stops the filter at the user's request and data-binds to config.groovy.- Author:
- Joakim Ahle <joakim.ahle@sonymobile.com>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
JCASC_NAME
-
Fields inherited from class hudson.model.Descriptor
clazz
-
-
Constructor Summary
Constructors Constructor Description PluginImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
When submit is pressed on the global config page and any settings for this plugin are changed, this method is called.String
getAccountName()
Used by groovy for data-binding.boolean
getAnonymousAccess()
Used by groovy for data-binding.GlobalConfigurationCategory
getCategory()
protected XmlFile
getConfigFile()
boolean
getEnabled()
Used by groovy for data-binding.static PluginImpl
getInstance()
Fetches the singleton instance of this plugin.String
getKrb5Location()
Used by groovy for data-binding.String
getLoginClientModule()
Used by groovy for data-binding.String
getLoginLocation()
Used by groovy for data-binding.String
getLoginServerModule()
Used by groovy for data-binding.Secret
getPassword()
Used by groovy for data-binding.String
getRedirect()
Used by groovy for data-binding.boolean
isAllowBasic()
Used by groovy for data-binding.boolean
isAllowDelegation()
Used by groovy for data-binding.boolean
isAllowLocalhost()
Used by groovy for data-binding.boolean
isAllowUnsecureBasic()
Used by groovy for data-binding.boolean
isPromptNtlm()
Used by groovy for data-binding.boolean
isRedirectEnabled()
Used by groovy for data-binding.boolean
isRestartNeeded()
Deprecated.Unusedvoid
setAccountName(String accountName)
Set accountName config parameter.void
setAllowBasic(boolean allowBasic)
Set allowBasic config parameter.void
setAllowDelegation(boolean allowDelegation)
Set allowDelegation config parameter.void
setAllowLocalhost(boolean allowLocalhost)
Set allowLocalhost config parameter.void
setAllowUnsecureBasic(boolean allowUnsecureBasic)
Set allowUnsecureBasic config parameter.void
setAnonymousAccess(boolean anonymousAccess)
Set login all URLs.void
setEnabled(boolean enabled)
Set enabled config parameter.void
setKrb5Location(String krb5Location)
Set krb5Location config parameter.void
setLoginClientModule(String loginClientModule)
Set loginClientModule config parameter.void
setLoginLocation(String loginLocation)
Set loginLocation config parameter.void
setLoginServerModule(String loginServerModule)
Set loginServerModule config parameter.void
setPassword(Secret password)
void
setPromptNtlm(boolean promptNtlm)
Set promptNtlm config parameter.void
setRedirect(String redirect)
Set redirect config parameter.void
setRedirectEnabled(boolean redirectEnabled)
Set redirectEnabled config parameter.static void
start()
Starts the plugin.static void
stop()
Stops this plugin and removes the filter from Jenkins.-
Methods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPage
-
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCheckMethod, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Field Detail
-
JCASC_NAME
public static final String JCASC_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static PluginImpl getInstance()
Fetches the singleton instance of this plugin.- Returns:
- the instance.
-
getCategory
@NonNull public GlobalConfigurationCategory getCategory()
- Overrides:
getCategory
in classDescriptor<GlobalConfiguration>
-
start
@Initializer(after=PLUGINS_STARTED) @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static void start()
Starts the plugin. Loads previous configuration if such exists.
-
stop
@Terminator(after=COMPLETED) @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static void stop()
Stops this plugin and removes the filter from Jenkins.
-
getConfigFile
protected XmlFile getConfigFile()
- Overrides:
getConfigFile
in classDescriptor<GlobalConfiguration>
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData) throws Descriptor.FormException
When submit is pressed on the global config page and any settings for this plugin are changed, this method is called. It updates all the fields, restarts or stops the filter depending on configuration and saves the configuration to disk.- Overrides:
configure
in classGlobalConfiguration
- Parameters:
req
- the Stapler Request to serve.formData
- the JSON data containing the new configuration.- Throws:
Descriptor.FormException
- if any data in the form is wrong.
-
setEnabled
public void setEnabled(boolean enabled)
Set enabled config parameter.- Parameters:
enabled
- value of enabled
-
setAccountName
public void setAccountName(String accountName)
Set accountName config parameter.- Parameters:
accountName
- value of accountName
-
setPassword
public void setPassword(@NonNull Secret password)
-
setRedirectEnabled
public void setRedirectEnabled(boolean redirectEnabled)
Set redirectEnabled config parameter.- Parameters:
redirectEnabled
- value of redirectEnabled
-
setRedirect
public void setRedirect(String redirect)
Set redirect config parameter.- Parameters:
redirect
- value of redirect
-
setKrb5Location
public void setKrb5Location(String krb5Location)
Set krb5Location config parameter.- Parameters:
krb5Location
- value of krb5Location
-
setLoginLocation
public void setLoginLocation(String loginLocation)
Set loginLocation config parameter.- Parameters:
loginLocation
- value of loginLocation
-
setLoginServerModule
public void setLoginServerModule(String loginServerModule)
Set loginServerModule config parameter.- Parameters:
loginServerModule
- value of loginServerModule
-
setLoginClientModule
public void setLoginClientModule(String loginClientModule)
Set loginClientModule config parameter.- Parameters:
loginClientModule
- value of loginClientModule
-
setAllowLocalhost
public void setAllowLocalhost(boolean allowLocalhost)
Set allowLocalhost config parameter.- Parameters:
allowLocalhost
- value of allowLocalhost
-
setAllowBasic
public void setAllowBasic(boolean allowBasic)
Set allowBasic config parameter.- Parameters:
allowBasic
- value of allowBasic
-
setAllowDelegation
public void setAllowDelegation(boolean allowDelegation)
Set allowDelegation config parameter.- Parameters:
allowDelegation
- value of allowDelegation
-
setAllowUnsecureBasic
public void setAllowUnsecureBasic(boolean allowUnsecureBasic)
Set allowUnsecureBasic config parameter.- Parameters:
allowUnsecureBasic
- value of allowUnsecureBasic
-
setPromptNtlm
public void setPromptNtlm(boolean promptNtlm)
Set promptNtlm config parameter.- Parameters:
promptNtlm
- value of promptNtlm
-
getEnabled
public boolean getEnabled()
Used by groovy for data-binding.- Returns:
- whether the Filter is currently enabled or not.
-
getAccountName
public String getAccountName()
Used by groovy for data-binding.- Returns:
- the current service / pre-auth account.
-
getPassword
public Secret getPassword()
Used by groovy for data-binding.- Returns:
- the current service / pre-auth password as a secret.
-
isRedirectEnabled
public boolean isRedirectEnabled()
Used by groovy for data-binding.- Returns:
- whether the user has checked domain redirection or not.
-
getRedirect
public String getRedirect()
Used by groovy for data-binding.- Returns:
- the current domain to redirect to, if redirect is enabled.
-
getKrb5Location
public String getKrb5Location()
Used by groovy for data-binding.- Returns:
- the current location of the krb5.conf file.
-
getLoginLocation
public String getLoginLocation()
Used by groovy for data-binding.- Returns:
- the current location of the login.conf file.
-
getLoginServerModule
public String getLoginServerModule()
Used by groovy for data-binding.- Returns:
- the current Login-server module.
-
getLoginClientModule
public String getLoginClientModule()
Used by groovy for data-binding.- Returns:
- the current Login-client module.
-
getAnonymousAccess
public boolean getAnonymousAccess()
Used by groovy for data-binding.- Returns:
- whether the user needs to authenticate on non-login URLs.
-
setAnonymousAccess
public void setAnonymousAccess(boolean anonymousAccess)
Set login all URLs.- Parameters:
anonymousAccess
- Permit anonymous access.
-
isAllowLocalhost
public boolean isAllowLocalhost()
Used by groovy for data-binding.- Returns:
- whether Localhost should be allowed without authentication or not.
-
isAllowUnsecureBasic
public boolean isAllowUnsecureBasic()
Used by groovy for data-binding.- Returns:
- whether unsecure basic should be used if Kerberos fails.
-
isPromptNtlm
public boolean isPromptNtlm()
Used by groovy for data-binding.- Returns:
- whether NTLM users should be prompted to use basic authentication.
-
isAllowDelegation
public boolean isAllowDelegation()
Used by groovy for data-binding.- Returns:
- whether servlet delegation should be used.
-
isAllowBasic
public boolean isAllowBasic()
Used by groovy for data-binding.- Returns:
- whether Basic authentication should be used if Kerberos fails.
-
isRestartNeeded
@Deprecated public boolean isRestartNeeded()
Deprecated.UnusedUsed to determine if Jenkins have to be restarted for the config changes to take place.- Returns:
- whether Jenkins has to be restarted.
-
-