use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class SpiderDialog method setUsers.
private void setUsers() {
Context context = this.getSelectedContext();
List<String> userNames = new ArrayList<>();
if (context != null) {
List<User> users = this.extUserMgmt.getContextUserAuthManager(context.getId()).getUsers();
// The default should always be 'not specified'
userNames.add("");
for (User user : users) {
userNames.add(user.getName());
}
}
this.setComboFields(FIELD_USER, userNames, "");
// Theres always 1..
this.getField(FIELD_USER).setEnabled(userNames.size() > 1);
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class SpiderDialog method getSelectedUser.
private User getSelectedUser() {
Context context = this.getSelectedContext();
if (context != null) {
String userName = this.getStringValue(FIELD_USER);
List<User> users = this.extUserMgmt.getContextUserAuthManager(context.getId()).getUsers();
for (User user : users) {
if (userName.equals(user.getName())) {
return user;
}
}
}
return null;
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class ContextStructurePanel method saveContextData.
@Override
public void saveContextData(Session session) throws Exception {
Context context = session.getContext(getContextId());
saveToContext(context, true);
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class DeleteContextAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
List<Context> contexts = getContexts();
if (contexts.isEmpty()) {
return;
}
String contextList = contexts.stream().map(Context::getName).collect(Collectors.joining("\n"));
if (View.getSingleton().showConfirmDialog(contexts.size() > 1 ? Constant.messages.getString("context.delete.warning.multiple", contextList) : Constant.messages.getString("context.delete.warning")) == JOptionPane.OK_OPTION) {
for (Context context : contexts) {
Model.getSingleton().getSession().deleteContext(context);
}
}
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class ContextExcludePanel method saveContextData.
@Override
public void saveContextData(Session session) throws Exception {
Context context = session.getContext(getContextId());
context.setExcludeFromContextRegexs(regexesPanel.getRegexes());
}
Aggregations