Search in sources :

Example 6 with AuthenticationMethodType

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);
    }
}
Also used : HttpAuthenticationMethodType(org.zaproxy.zap.authentication.HttpAuthenticationMethodType) FormBasedAuthenticationMethodType(org.zaproxy.zap.authentication.FormBasedAuthenticationMethodType) ScriptBasedAuthenticationMethodType(org.zaproxy.zap.authentication.ScriptBasedAuthenticationMethodType) ManualAuthenticationMethodType(org.zaproxy.zap.authentication.ManualAuthenticationMethodType) AuthenticationMethodType(org.zaproxy.zap.authentication.AuthenticationMethodType) ManualAuthenticationMethodType(org.zaproxy.zap.authentication.ManualAuthenticationMethodType) HttpAuthenticationMethodType(org.zaproxy.zap.authentication.HttpAuthenticationMethodType) FormBasedAuthenticationMethodType(org.zaproxy.zap.authentication.FormBasedAuthenticationMethodType) ScriptBasedAuthenticationMethodType(org.zaproxy.zap.authentication.ScriptBasedAuthenticationMethodType)

Example 7 with AuthenticationMethodType

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);
    }
}
Also used : HttpAuthenticationMethodType(org.zaproxy.zap.authentication.HttpAuthenticationMethodType) FormBasedAuthenticationMethodType(org.zaproxy.zap.authentication.FormBasedAuthenticationMethodType) ScriptBasedAuthenticationMethodType(org.zaproxy.zap.authentication.ScriptBasedAuthenticationMethodType) ManualAuthenticationMethodType(org.zaproxy.zap.authentication.ManualAuthenticationMethodType) AuthenticationMethodType(org.zaproxy.zap.authentication.AuthenticationMethodType) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 8 with AuthenticationMethodType

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();
    }
}
Also used : AuthenticationMethodType(org.zaproxy.zap.authentication.AuthenticationMethodType) Insets(java.awt.Insets)

Aggregations

AuthenticationMethodType (org.zaproxy.zap.authentication.AuthenticationMethodType)8 FormBasedAuthenticationMethodType (org.zaproxy.zap.authentication.FormBasedAuthenticationMethodType)3 HttpAuthenticationMethodType (org.zaproxy.zap.authentication.HttpAuthenticationMethodType)3 ManualAuthenticationMethodType (org.zaproxy.zap.authentication.ManualAuthenticationMethodType)3 ScriptBasedAuthenticationMethodType (org.zaproxy.zap.authentication.ScriptBasedAuthenticationMethodType)3 DatabaseException (org.parosproxy.paros.db.DatabaseException)2 Insets (java.awt.Insets)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 Pattern (java.util.regex.Pattern)1 AuthenticationMethod (org.zaproxy.zap.authentication.AuthenticationMethod)1 ApiDynamicActionImplementor (org.zaproxy.zap.extension.api.ApiDynamicActionImplementor)1 ApiException (org.zaproxy.zap.extension.api.ApiException)1 ApiResponseList (org.zaproxy.zap.extension.api.ApiResponseList)1 AuthorizationDetectionMethod (org.zaproxy.zap.extension.authorization.AuthorizationDetectionMethod)1 Context (org.zaproxy.zap.model.Context)1 User (org.zaproxy.zap.users.User)1