Package org.zaproxy.zap.authentication
Class ManualAuthenticationMethodType
- java.lang.Object
-
- org.zaproxy.zap.authentication.AuthenticationMethodType
-
- org.zaproxy.zap.authentication.ManualAuthenticationMethodType
-
public class ManualAuthenticationMethodType extends AuthenticationMethodType
The implementation for anAuthenticationMethodType
where the user manually authenticates and then just selects an already authenticatedWebSession
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ManualAuthenticationMethodType.ManualAuthenticationMethod
The implementation for anAuthenticationMethod
where the user manually authenticates and then just selects an already authenticatedWebSession
.-
Nested classes/interfaces inherited from class org.zaproxy.zap.authentication.AuthenticationMethodType
AuthenticationMethodType.UnsupportedAuthenticationMethodException
-
-
Field Summary
-
Fields inherited from class org.zaproxy.zap.authentication.AuthenticationMethodType
NULL_ENCODER
-
-
Constructor Summary
Constructors Constructor Description ManualAuthenticationMethodType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractCredentialsOptionsPanel<? extends AuthenticationCredentials>
buildCredentialsOptionsPanel(AuthenticationCredentials credentials, Context uiSharedContext)
Builds the options panel that can be used to fully configure an.AbstractAuthenticationMethodOptionsPanel
buildOptionsPanel(Context uiSharedContext)
Builds the options panel that can be used to fully configure an authentication method.org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials
createAuthenticationCredentials()
Creates a new, empty, Authentication Credentials object corresponding to this type of Authentication method.static org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials
createAuthenticationCredentials(HttpSession session)
ManualAuthenticationMethodType.ManualAuthenticationMethod
createAuthenticationMethod(int contextId)
Builds a new, empty, authentication method.void
exportData(org.apache.commons.configuration.Configuration config, AuthenticationMethod authMethod)
Export the specified method to the configurationjava.lang.Class<org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials>
getAuthenticationCredentialsType()
Gets the type of the authentication credentials that this authentication method creates.java.lang.String
getName()
Gets the name of the authentication method.ApiDynamicActionImplementor
getSetCredentialsForUserApiAction()
Gets theApiDynamicActionImplementor
that can be used to set the authentication credentials of the corresponding type for anUser
of a context.ApiDynamicActionImplementor
getSetMethodForContextApiAction()
Gets theApiAction
that can be used to set an authentication method of this type for a context.int
getUniqueIdentifier()
Gets the unique identifier of this Authentication Method Type.boolean
hasCredentialsOptionsPanel()
Checks if the correspondingAuthenticationCredentials
has an options panel that can be used for its configuration.boolean
hasOptionsPanel()
Checks if the correspondingAuthenticationMethod
has an options panel that can be used for configuration.void
hook(ExtensionHook extensionHook)
Hooks the Authentication Method Type with other components of ZAP, if needed.void
importData(org.apache.commons.configuration.Configuration config, AuthenticationMethod authMethod)
Import the method from the configurationboolean
isTypeForMethod(AuthenticationMethod method)
Checks if is this is a type for the Authentication Method provided as parameter.AuthenticationMethod
loadMethodFromSession(Session session, int contextId)
Loads an authentication method from the Session.void
persistMethodToSession(Session session, int contextId, AuthenticationMethod authMethod)
Persists the authentication method to the session.-
Methods inherited from class org.zaproxy.zap.authentication.AuthenticationMethodType
equals, hashCode, toString
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:AuthenticationMethodType
Gets the name of the authentication method.- Specified by:
getName
in classAuthenticationMethodType
- Returns:
- the name
-
hasOptionsPanel
public boolean hasOptionsPanel()
Description copied from class:AuthenticationMethodType
Checks if the correspondingAuthenticationMethod
has an options panel that can be used for configuration.- Specified by:
hasOptionsPanel
in classAuthenticationMethodType
- Returns:
- true, if it needs one
- See Also:
AuthenticationMethodType.buildOptionsPanel(Context)
-
hasCredentialsOptionsPanel
public boolean hasCredentialsOptionsPanel()
Description copied from class:AuthenticationMethodType
Checks if the correspondingAuthenticationCredentials
has an options panel that can be used for its configuration.- Specified by:
hasCredentialsOptionsPanel
in classAuthenticationMethodType
- Returns:
- true, if it needs one
-
createAuthenticationMethod
public ManualAuthenticationMethodType.ManualAuthenticationMethod createAuthenticationMethod(int contextId)
Description copied from class:AuthenticationMethodType
Builds a new, empty, authentication method. The authentication method should then be configured through the Options panel.- Specified by:
createAuthenticationMethod
in classAuthenticationMethodType
- Parameters:
contextId
- the ID of the context for which the authentication method is being created- Returns:
- the authentication method
- See Also:
AuthenticationMethodType.buildOptionsPanel(Context)
-
buildOptionsPanel
public AbstractAuthenticationMethodOptionsPanel buildOptionsPanel(Context uiSharedContext)
Description copied from class:AuthenticationMethodType
Builds the options panel that can be used to fully configure an authentication method.This method just builds an empty options panel. For binding an existing method to the panel,
AbstractAuthenticationMethodOptionsPanel.bindMethod(AuthenticationMethod)
should be used.- Specified by:
buildOptionsPanel
in classAuthenticationMethodType
- Parameters:
uiSharedContext
- the shared context on which the panel should work- Returns:
- the abstract authentication method options panel
- See Also:
AuthenticationMethodType.hasOptionsPanel()
-
buildCredentialsOptionsPanel
public AbstractCredentialsOptionsPanel<? extends AuthenticationCredentials> buildCredentialsOptionsPanel(AuthenticationCredentials credentials, Context uiSharedContext)
Description copied from class:AuthenticationMethodType
Builds the options panel that can be used to fully configure an.- Specified by:
buildCredentialsOptionsPanel
in classAuthenticationMethodType
- Parameters:
credentials
- the credentialsuiSharedContext
- the shared context on which the panel should work- Returns:
- the abstract credentials options panel
AuthenticationCredentials
object.
-
isTypeForMethod
public boolean isTypeForMethod(AuthenticationMethod method)
Description copied from class:AuthenticationMethodType
Checks if is this is a type for the Authentication Method provided as parameter.- Specified by:
isTypeForMethod
in classAuthenticationMethodType
- Parameters:
method
- the method- Returns:
- true, if is factory for method
-
hook
public void hook(ExtensionHook extensionHook)
Description copied from class:AuthenticationMethodType
Hooks the Authentication Method Type with other components of ZAP, if needed. This method should is called only ones, when authentication types are loaded.For example, PopupMenus can be registered.
- Specified by:
hook
in classAuthenticationMethodType
- Parameters:
extensionHook
- the extension hook
-
loadMethodFromSession
public AuthenticationMethod loadMethodFromSession(Session session, int contextId)
Description copied from class:AuthenticationMethodType
Loads an authentication method from the Session. The implementation depends on the Authentication method type.- Specified by:
loadMethodFromSession
in classAuthenticationMethodType
- Parameters:
session
- the sessioncontextId
- the ID of the context- Returns:
- the authentication method
-
persistMethodToSession
public void persistMethodToSession(Session session, int contextId, AuthenticationMethod authMethod)
Description copied from class:AuthenticationMethodType
Persists the authentication method to the session.- Specified by:
persistMethodToSession
in classAuthenticationMethodType
- Parameters:
session
- the sessioncontextId
- the context idauthMethod
- the auth method to persist
-
getUniqueIdentifier
public int getUniqueIdentifier()
Description copied from class:AuthenticationMethodType
Gets the unique identifier of this Authentication Method Type. It has to be unique among all Authentication Method Types.- Specified by:
getUniqueIdentifier
in classAuthenticationMethodType
- Returns:
- the unique identifier
-
createAuthenticationCredentials
public org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials createAuthenticationCredentials()
Description copied from class:AuthenticationMethodType
Creates a new, empty, Authentication Credentials object corresponding to this type of Authentication method.- Specified by:
createAuthenticationCredentials
in classAuthenticationMethodType
- Returns:
- the authentication credentials
-
getAuthenticationCredentialsType
public java.lang.Class<org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials> getAuthenticationCredentialsType()
Description copied from class:AuthenticationMethodType
Gets the type of the authentication credentials that this authentication method creates.- Specified by:
getAuthenticationCredentialsType
in classAuthenticationMethodType
- Returns:
- the type of the authentication credentials, should not be
null
.
-
createAuthenticationCredentials
public static org.zaproxy.zap.authentication.ManualAuthenticationMethodType.ManualAuthenticationCredentials createAuthenticationCredentials(HttpSession session)
-
getSetMethodForContextApiAction
public ApiDynamicActionImplementor getSetMethodForContextApiAction()
Description copied from class:AuthenticationMethodType
Gets theApiAction
that can be used to set an authentication method of this type for a context.This api action will be handled by executing the
ApiDynamicActionImplementor.handleAction(JSONObject)
method.- Specified by:
getSetMethodForContextApiAction
in classAuthenticationMethodType
- Returns:
- the api action, or null if there is no way to set this method type through the API
-
getSetCredentialsForUserApiAction
public ApiDynamicActionImplementor getSetCredentialsForUserApiAction()
Description copied from class:AuthenticationMethodType
Gets theApiDynamicActionImplementor
that can be used to set the authentication credentials of the corresponding type for anUser
of a context.This api action will be handled by executing the
ApiDynamicActionImplementor.handleAction(JSONObject)
method.- Specified by:
getSetCredentialsForUserApiAction
in classAuthenticationMethodType
- Returns:
- the api action, or null if there is no way to set this method type through the API
-
exportData
public void exportData(org.apache.commons.configuration.Configuration config, AuthenticationMethod authMethod)
Description copied from class:AuthenticationMethodType
Export the specified method to the configuration- Specified by:
exportData
in classAuthenticationMethodType
- Parameters:
config
- theConfiguration
where to export/save the authentication methodauthMethod
- the authentication method to be exported
-
importData
public void importData(org.apache.commons.configuration.Configuration config, AuthenticationMethod authMethod) throws org.apache.commons.configuration.ConfigurationException
Description copied from class:AuthenticationMethodType
Import the method from the configuration- Specified by:
importData
in classAuthenticationMethodType
- Parameters:
config
- theConfiguration
from where to import/load the authentication methodauthMethod
- where to set the imported authentication method data- Throws:
org.apache.commons.configuration.ConfigurationException
- if an error occurred while reading the authentication method data
-
-