Class PluginImpl

All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, 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 the KerberosSSOFilter It also starts / stops the filter at the user's request and data-binds to config.groovy.
Author:
Joakim Ahle <joakim.ahle@sonymobile.com>
  • Field Details

  • Constructor Details

    • PluginImpl

      public PluginImpl()
  • Method Details

    • getInstance

      public static PluginImpl getInstance()
      Fetches the singleton instance of this plugin.
      Returns:
      the instance.
    • getCategory

      @NonNull public GlobalConfigurationCategory getCategory()
      Overrides:
      getCategory in class Descriptor<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 class Descriptor<GlobalConfiguration>
    • configure

      public boolean configure(org.kohsuke.stapler.StaplerRequest2 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 class GlobalConfiguration
      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.
      Unused
      Used to determine if Jenkins have to be restarted for the config changes to take place.
      Returns:
      whether Jenkins has to be restarted.