org.jenkinsci.plugins.authorizeproject.strategy
Class SpecificUsersAuthorizationStrategy.DescriptorImpl

java.lang.Object
  extended by hudson.model.Descriptor<AuthorizeProjectStrategy>
      extended by org.jenkinsci.plugins.authorizeproject.AuthorizeProjectStrategyDescriptor
          extended by org.jenkinsci.plugins.authorizeproject.strategy.SpecificUsersAuthorizationStrategy.DescriptorImpl
All Implemented Interfaces:
hudson.model.Saveable
Enclosing class:
SpecificUsersAuthorizationStrategy

@Extension
public static class SpecificUsersAuthorizationStrategy.DescriptorImpl
extends AuthorizeProjectStrategyDescriptor


Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
hudson.model.Descriptor.FormException, hudson.model.Descriptor.PropertyType, hudson.model.Descriptor.Self
 
Field Summary
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
  SpecificUsersAuthorizationStrategy.DescriptorImpl()
           
protected SpecificUsersAuthorizationStrategy.DescriptorImpl(Class<? extends AuthorizeProjectStrategy> clazz)
          For testing purpose.
 
Method Summary
protected  boolean authenticate(SpecificUsersAuthorizationStrategy strategy, org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
          Authenticate the specified user.
protected  boolean authenticate(SpecificUsersAuthorizationStrategy strategy, String password)
          Authenticate the specified user.
protected  boolean authenticateWithApitoken(SpecificUsersAuthorizationStrategy strategy, String apitoken)
          Authenticate the specified user with Apitoken.
 String calcCheckPasswordRequestedUrl()
           
 hudson.util.FormValidation doCheckNoNeedReauthentication(boolean noNeedReauthentication)
           
 hudson.util.FormValidation doCheckPassword(org.kohsuke.stapler.StaplerRequest req, String userid, String password, String apitoken, boolean useApitoken, boolean noNeedReauthentication)
           
 String doCheckPasswordRequested(org.kohsuke.stapler.StaplerRequest req, String userid, boolean noNeedReauthentication)
          Checks password field is required in configuration page.
 hudson.util.FormValidation doCheckUserid(String userid)
           
 String getDisplayName()
           
 boolean isEnabledByDefault()
          SpecificUsersAuthorizationStrategy should be disabled by default for JENKINS-28298
 boolean isUseApitoken()
           
 SpecificUsersAuthorizationStrategy newInstance(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
          Create a new instance.
protected  SpecificUsersAuthorizationStrategy newInstanceWithoutAuthentication(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
          Create a new instance.
 
Methods inherited from class org.jenkinsci.plugins.authorizeproject.AuthorizeProjectStrategyDescriptor
configureFromGlobalSecurity, getConfigFile, getDescriptorsForGlobalSecurityConfigPage, getGlobalSecurityConfigPage
 
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, getCheckMethod, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificUsersAuthorizationStrategy.DescriptorImpl

public SpecificUsersAuthorizationStrategy.DescriptorImpl()

SpecificUsersAuthorizationStrategy.DescriptorImpl

protected SpecificUsersAuthorizationStrategy.DescriptorImpl(Class<? extends AuthorizeProjectStrategy> clazz)
For testing purpose.

Parameters:
clazz - set SpecificUsersAuthorizationStrategy.class
Method Detail

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in class hudson.model.Descriptor<AuthorizeProjectStrategy>
Returns:
the name shown in project configuration pages.
See Also:
Descriptor.getDisplayName()

newInstanceWithoutAuthentication

protected SpecificUsersAuthorizationStrategy newInstanceWithoutAuthentication(org.kohsuke.stapler.StaplerRequest req,
                                                                              net.sf.json.JSONObject formData)
                                                                       throws hudson.model.Descriptor.FormException
Create a new instance. No authentication is performed.

Parameters:
req -
formData -
Returns:
Throws:
hudson.model.Descriptor.FormException - thrown when the input is incomplete.

authenticate

protected boolean authenticate(SpecificUsersAuthorizationStrategy strategy,
                               String password)
Authenticate the specified user. Checks whether the user has privilege to specify that authorization.

Parameters:
strategy -
password -
Returns:
true if the authentication is succeeded.

authenticateWithApitoken

protected boolean authenticateWithApitoken(SpecificUsersAuthorizationStrategy strategy,
                                           String apitoken)
Authenticate the specified user with Apitoken.

Parameters:
strategy -
apitoken -
Returns:
true if the authentication is succeeded.

authenticate

protected boolean authenticate(SpecificUsersAuthorizationStrategy strategy,
                               org.kohsuke.stapler.StaplerRequest req,
                               net.sf.json.JSONObject formData)
Authenticate the specified user. Checks whether the user has privilege to specify that authorization.

Parameters:
strategy -
req -
formData -
Returns:
true if the authentication is succeeded.

newInstance

public SpecificUsersAuthorizationStrategy newInstance(org.kohsuke.stapler.StaplerRequest req,
                                                      net.sf.json.JSONObject formData)
                                               throws hudson.model.Descriptor.FormException
Create a new instance. Also performs authentication.

Overrides:
newInstance in class hudson.model.Descriptor<AuthorizeProjectStrategy>
Parameters:
req -
formData -
Returns:
Throws:
hudson.model.Descriptor.FormException - thrown when the input is incomplete, or authentication failed.

calcCheckPasswordRequestedUrl

public String calcCheckPasswordRequestedUrl()
Returns:
the URL to check password field is required.

doCheckPasswordRequested

public String doCheckPasswordRequested(org.kohsuke.stapler.StaplerRequest req,
                                       @QueryParameter
                                       String userid,
                                       @QueryParameter
                                       boolean noNeedReauthentication)
Checks password field is required in configuration page. This is called asynchronously.

Parameters:
req -
userid -
noNeedReauthentication -
Returns:
"true" if password fiels is required. this should be evaluated as JavaScript.

doCheckUserid

public hudson.util.FormValidation doCheckUserid(@QueryParameter
                                                String userid)
Parameters:
userid -
Returns:

doCheckPassword

public hudson.util.FormValidation doCheckPassword(org.kohsuke.stapler.StaplerRequest req,
                                                  @QueryParameter
                                                  String userid,
                                                  @QueryParameter
                                                  String password,
                                                  @QueryParameter
                                                  String apitoken,
                                                  @QueryParameter
                                                  boolean useApitoken,
                                                  @QueryParameter
                                                  boolean noNeedReauthentication)
Parameters:
req -
userid -
password -
noNeedReauthentication -
Returns:

doCheckNoNeedReauthentication

public hudson.util.FormValidation doCheckNoNeedReauthentication(@QueryParameter
                                                                boolean noNeedReauthentication)
Parameters:
noNeedReauthentication -
Returns:

isUseApitoken

public boolean isUseApitoken()

isEnabledByDefault

public boolean isEnabledByDefault()
SpecificUsersAuthorizationStrategy should be disabled by default for JENKINS-28298

Overrides:
isEnabledByDefault in class AuthorizeProjectStrategyDescriptor
Returns:
false
See Also:
AuthorizeProjectStrategyDescriptor.isEnabledByDefault()


Copyright © 2004-2015. All Rights Reserved.