use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class ManualAuthenticationMethodType method getSetMethodForContextApiAction.
@Override
public ApiDynamicActionImplementor getSetMethodForContextApiAction() {
return new ApiDynamicActionImplementor(API_METHOD_NAME, null, null) {
@Override
public void handleAction(JSONObject params) throws ApiException {
Context context = ApiUtils.getContextByParamId(params, AuthenticationAPI.PARAM_CONTEXT_ID);
ManualAuthenticationMethod method = createAuthenticationMethod(context.getId());
context.setAuthenticationMethod(method);
}
};
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class HttpAuthSessionManagementMethodType method getSetMethodForContextApiAction.
@Override
public ApiDynamicActionImplementor getSetMethodForContextApiAction() {
return new ApiDynamicActionImplementor(API_METHOD_NAME, null, null) {
@Override
public void handleAction(JSONObject params) throws ApiException {
Context context = ApiUtils.getContextByParamId(params, SessionManagementAPI.PARAM_CONTEXT_ID);
context.setSessionManagementMethod(createSessionManagementMethod(context.getId()));
}
};
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class HostProcessUnitTest method isCustomPageShouldReturnTrueWhenCustomPageMatches.
@Test
void isCustomPageShouldReturnTrueWhenCustomPageMatches() {
// Given
Context context = mock(Context.class);
hostProcess.setContext(context);
HttpMessage msg = new HttpMessage();
CustomPage.Type cpType = CustomPage.Type.OTHER;
given(context.isCustomPage(msg, cpType)).willReturn(true);
// When / Then
assertTrue(hostProcess.isCustomPage(msg, cpType));
verify(context).isCustomPage(msg, cpType);
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class HostProcessUnitTest method isCustomPageShouldReturnFalseWhenContextIsNull.
@Test
void isCustomPageShouldReturnFalseWhenContextIsNull() {
// Given
Context context = mock(Context.class);
hostProcess.setContext(null);
HttpMessage msg = new HttpMessage();
CustomPage.Type cpType = CustomPage.Type.OTHER;
// When / Then
assertFalse(hostProcess.isCustomPage(msg, cpType));
verifyNoInteractions(context);
}
Aggregations