Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
HejdaJakub committed Nov 7, 2023
2 parents 50a3042 + 26af76d commit a355de7
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 249 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class Utils {
organizationsTranslation.put("@elixir-europe.org", "Elixir Europe");
organizationsTranslation.put("@github.extidp.cesnet.cz", "GitHub");
organizationsTranslation.put("@orcid.extidp.cesnet.cz", "OrcID");
organizationsTranslation.put("@microsoft.extidp.cesnet.cz", "Microsoft");

organizationsTranslation.put("@google", "Google");
organizationsTranslation.put("@facebook", "Facebook");
Expand All @@ -116,6 +117,7 @@ public class Utils {
organizationsTranslation.put("@seznam", "Seznam");
organizationsTranslation.put("@github", "GitHub");
organizationsTranslation.put("@orcid", "OrcID");
organizationsTranslation.put("@microsoft", "Microsoft");

// kerberos
organizationsTranslation.put("META", "MetaCentrum");
Expand All @@ -131,7 +133,8 @@ public class Utils {
//organizationsTranslation.put("https://login.e-infra.cz/idp/", "e-INFRA CZ AAI");

// EGI
organizationsTranslation.put("https://aai.egi.eu/proxy/saml2/idp/metadata.php", "EGI Check-In");
organizationsTranslation.put("https://aai.egi.eu/proxy/saml2/idp/metadata.php", "EGI CheckIn");
organizationsTranslation.put("https://aai.egi.eu/auth/realms/egi", "EGI CheckIn"); // keycoak based
organizationsTranslation.put("https://sso.egi.eu/edugainidp/shibboleth", "EGI Foundation");
organizationsTranslation.put("https://sso.egi.eu/egissoidp/shibboleth", "EGI SSO");
organizationsTranslation.put("https://www.egi.eu/idp/shibboleth", "EGI SSO");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,19 @@ public static Request validatePreferredEmailChange(int userId, String token, Jso

}

/**
* Validate ssh public key, throws exception if validation fails
*
* @param sshKey ssh public key to verify
* @return Request unique request
*/
public static Request validateSSHKey(String sshKey, JsonEvents events) {
JsonClient client = new JsonClient(events);
client.put("sshKey", sshKey);

return client.call(USERS_MANAGER + "validateSSHKey");
}

/**
* Change password in selected namespace
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("Unable to check login availability! Please check your internet connection and try again later.")
public String checkingLoginFailed();

@DefaultMessage("Unable to check SSH key validity! Please check your internet connection and try again later.")
public String checkingSSHFailed();
@DefaultMessage("Login contains invalid character(s) or is not allowed!")
public String loginNotAllowed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ protected Widget initWidget() {
if (widget instanceof CheckBox) {
CheckBox checkBox = (CheckBox) widget;
String[] parsedGroupName = checkBox.getText().split(Window.Location.getParameter("group") + ":");
// use group name without parent group prefix
checkBox.setText(parsedGroupName[1]);
// use group name without parent group prefix only if there is one
if (parsedGroupName[1] != null) {
checkBox.setText(parsedGroupName[1]);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.VerticalPanel;
import cz.metacentrum.perun.wui.json.Events;
import cz.metacentrum.perun.wui.model.PerunException;
import cz.metacentrum.perun.wui.registrar.client.resources.PerunRegistrarResources;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.ListBoxValidator;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.SshKeysListBoxValidator;
Expand All @@ -19,7 +20,9 @@
import org.gwtbootstrap3.client.ui.html.Paragraph;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Represents ListBox form item.
Expand All @@ -30,6 +33,7 @@ public class ListBox extends WidgetBox {

private final ListBoxValidator validator;
List<ExtendedTextBox> inputList;
Map<ExtendedTextBox, BlurHandler> handlers;

public ListBox(PerunForm form, ApplicationFormItemData item, String lang) {
super(form, item, lang);
Expand Down Expand Up @@ -78,6 +82,7 @@ public boolean validateLocal() {
@Override
protected Widget initWidget() {
inputList = new ArrayList<>();
handlers = new HashMap<>();
return super.initWidget();
}

Expand All @@ -95,13 +100,48 @@ protected void setValidationTriggers() {
if (isOnlyPreview()) {
return;
}
for (ExtendedTextBox input : inputList) {
input.addBlurHandler(new BlurHandler() {
if ("urn:perun:user:attribute-def:def:sshPublicKey".equals(this.getItemData().getFormItem().getPerunDestinationAttribute())) {
final Events<Boolean> nothingEvent = new Events<Boolean>() {
@Override
public void onBlur(BlurEvent event) {
validateLocal();
public void onFinished(Boolean result) {

}

@Override
public void onError(PerunException error) {

}
});

@Override
public void onLoadingStart() {

}
};

for (ExtendedTextBox input : inputList) {

if (!handlers.containsKey(input)) {
BlurHandler handler = new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
validate(nothingEvent);
}
};
input.addBlurHandler(handler);
handlers.put(input, handler);
}

}

} else {
for (ExtendedTextBox input : inputList) {
input.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
validateLocal();
}
});
}
}
}

Expand Down Expand Up @@ -154,8 +194,19 @@ protected void generateItemWithRemoveButton(VerticalPanel vp) {
PerunButton removeButton = new PerunButton("", new ClickHandler() {
public void onClick(ClickEvent event) {
inputList.remove(input);
handlers.remove(input);
vp.remove(hp);
validateLocal();
validate(new Events<Boolean>() {
@Override
public void onFinished(Boolean result) {
}
@Override
public void onError(PerunException error) {
}
@Override
public void onLoadingStart() {
}
});
}
});
setupRemoveButton(removeButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemData;
import cz.metacentrum.perun.wui.registrar.widgets.PerunForm;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.PerunFormItemValidator;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.SshKeysTextAreaValidator;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.TextAreaValidator;
import cz.metacentrum.perun.wui.widgets.boxes.ExtendedTextArea;
import org.gwtbootstrap3.client.ui.html.Paragraph;
Expand All @@ -27,12 +26,7 @@ public class TextArea extends PerunFormItemEditable {
public TextArea(PerunForm form, ApplicationFormItemData item, String lang) {
super(form, item, lang);

if ("urn:perun:user:attribute-def:def:sshPublicKey".equals(item.getFormItem().getPerunDestinationAttribute())) {
this.validator = new SshKeysTextAreaValidator();
} else {
this.validator = new TextAreaValidator();
}

this.validator = new TextAreaValidator();
}

protected Widget initWidget() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemData;
import cz.metacentrum.perun.wui.registrar.widgets.PerunForm;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.PerunFormItemValidator;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.SshKeysTextFieldValidator;
import cz.metacentrum.perun.wui.registrar.widgets.items.validators.TextFieldValidator;
import cz.metacentrum.perun.wui.widgets.boxes.ExtendedTextBox;
import org.gwtbootstrap3.client.ui.constants.ColumnSize;
Expand All @@ -29,11 +28,7 @@ public class TextField extends PerunFormItemEditable {

public TextField(PerunForm form, ApplicationFormItemData item, String lang) {
super(form, item, lang);
if ("urn:perun:user:attribute-def:def:sshPublicKey".equals(item.getFormItem().getPerunDestinationAttribute())) {
this.validator = new SshKeysTextFieldValidator();
} else {
this.validator = new TextFieldValidator();
}
this.validator = new TextFieldValidator();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ enum Result {
INVALID_FORMAT_EMAIL,
LOGIN_NOT_AVAILABLE,
CHECKING_LOGIN,
CHECKING_SSH,
CANT_CHECK_SSH,
CANT_CHECK_LOGIN,
EMPTY_PASSWORD,
PASSWORD_TOO_SHORT,
Expand Down
Loading

0 comments on commit a355de7

Please sign in to comment.