use of org.zaproxy.zap.authentication.AuthenticationMethodType in project zaproxy by zaproxy.
the class ExtensionAuthentication method loadAuthenticationMethodTypes.
/**
* Loads the authentication method types and hooks them up.
*
* @param hook the extension hook
*/
private void loadAuthenticationMethodTypes(ExtensionHook hook) {
this.authenticationMethodTypes = new ArrayList<>();
this.authenticationMethodTypes.add(new FormBasedAuthenticationMethodType());
this.authenticationMethodTypes.add(new HttpAuthenticationMethodType());
this.authenticationMethodTypes.add(new ManualAuthenticationMethodType());
this.authenticationMethodTypes.add(new ScriptBasedAuthenticationMethodType());
for (AuthenticationMethodType a : authenticationMethodTypes) {
a.hook(hook);
}
if (log.isInfoEnabled()) {
log.info("Loaded authentication method types: " + authenticationMethodTypes);
}
}
use of org.zaproxy.zap.authentication.AuthenticationMethodType in project zaproxy by zaproxy.
the class ExtensionAuthentication method loadContextData.
@Override
public void loadContextData(Session session, Context context) {
try {
List<String> typeL = session.getContextDataStrings(context.getIndex(), RecordContext.TYPE_AUTH_METHOD_TYPE);
if (typeL != null && typeL.size() > 0) {
AuthenticationMethodType t = getAuthenticationMethodTypeForIdentifier(Integer.parseInt(typeL.get(0)));
if (t != null) {
context.setAuthenticationMethod(t.loadMethodFromSession(session, context.getIndex()));
List<String> loginIndicatorL = session.getContextDataStrings(context.getIndex(), RecordContext.TYPE_AUTH_METHOD_LOGGEDIN_INDICATOR);
if (loginIndicatorL != null && loginIndicatorL.size() > 0)
context.getAuthenticationMethod().setLoggedInIndicatorPattern(loginIndicatorL.get(0));
List<String> logoutIndicatorL = session.getContextDataStrings(context.getIndex(), RecordContext.TYPE_AUTH_METHOD_LOGGEDOUT_INDICATOR);
if (logoutIndicatorL != null && logoutIndicatorL.size() > 0)
context.getAuthenticationMethod().setLoggedOutIndicatorPattern(logoutIndicatorL.get(0));
}
}
} catch (DatabaseException e) {
log.error("Unable to load Authentication method.", e);
}
}
use of org.zaproxy.zap.authentication.AuthenticationMethodType in project zaproxy by zaproxy.
the class DialogAddUser method initializeCredentialsConfigPanel.
/**
* Initialize credentials config panel.
*/
protected void initializeCredentialsConfigPanel() {
// Initialize the credentials config panel
AuthenticationMethodType type = workingContext.getAuthenticationMethod().getType();
if (type.hasCredentialsOptionsPanel()) {
credentialsPanel = type.buildCredentialsOptionsPanel(configuredCredentials, workingContext);
fieldsPanel.add(credentialsPanel, LayoutHelper.getGBC(0, 3, 2, 1, new Insets(4, 8, 2, 4)));
fieldsPanel.revalidate();
this.pack();
}
}
Aggregations