Skip to content

Commit 73b2bcf

Browse files
committed
Merge branch 'master' into production
2 parents cdc4935 + d892b28 commit 73b2bcf

File tree

66 files changed

+3302
-621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3302
-621
lines changed

package-lock.json

Lines changed: 129 additions & 197 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

perun-base/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@
7373
<groupId>org.springframework.boot</groupId>
7474
<artifactId>spring-boot-starter-logging</artifactId>
7575
</dependency>
76+
<!-- logback appender for writing into systemd-journald which in turn writes into syslog
77+
see https://github.com/gnieh/logback-journal
78+
-->
79+
<dependency>
80+
<groupId>org.gnieh</groupId>
81+
<artifactId>logback-journal</artifactId>
82+
<version>${logback-journal.version}</version>
83+
</dependency>
7684

7785
<!-- OTHER -->
7886
<dependency>

perun-base/src/main/java/cz/metacentrum/perun/core/api/CoreConfig.java

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ public void initBeansUtils() {
9494
private List<String> userInfoEndpointExtSourceLogin;
9595
private String userInfoEndpointExtSourceName;
9696
private List<String> userInfoEndpointExtSourceFriendlyName;
97-
private String userInfoEndpointAcrPropertyName;
98-
private String userInfoEndpointMfaAcrValue;
99-
private String userInfoEndpointMfaAuthTimestampPropertyName;
97+
private String introspectionEndpointMfaAcrValue;
10098
private int mfaAuthTimeout;
10199
private boolean enforceMfa;
102100
private int idpLoginValidity;
@@ -792,28 +790,12 @@ public void setUserInfoEndpointExtSourceFriendlyName(List<String> userInfoEndpoi
792790
this.userInfoEndpointExtSourceFriendlyName = userInfoEndpointExtSourceFriendlyName;
793791
}
794792

795-
public String getUserInfoEndpointAcrPropertyName() {
796-
return userInfoEndpointAcrPropertyName;
793+
public String getIntrospectionEndpointMfaAcrValue() {
794+
return introspectionEndpointMfaAcrValue;
797795
}
798796

799-
public void setUserInfoEndpointAcrPropertyName(String userInfoEndpointAcrPropertyName) {
800-
this.userInfoEndpointAcrPropertyName = userInfoEndpointAcrPropertyName;
801-
}
802-
803-
public String getUserInfoEndpointMfaAuthTimestampPropertyName() {
804-
return userInfoEndpointMfaAuthTimestampPropertyName;
805-
}
806-
807-
public void setUserInfoEndpointMfaAuthTimestampPropertyName(String userInfoEndpointMfaAuthTimestampPropertyName) {
808-
this.userInfoEndpointMfaAuthTimestampPropertyName = userInfoEndpointMfaAuthTimestampPropertyName;
809-
}
810-
811-
public String getUserInfoEndpointMfaAcrValue() {
812-
return userInfoEndpointMfaAcrValue;
813-
}
814-
815-
public void setUserInfoEndpointMfaAcrValue(String userInfoEndpointAcrValue) {
816-
this.userInfoEndpointMfaAcrValue = userInfoEndpointAcrValue;
797+
public void setIntrospectionEndpointMfaAcrValue(String introspectionEndpointMfaAcrValue) {
798+
this.introspectionEndpointMfaAcrValue = introspectionEndpointMfaAcrValue;
817799
}
818800

819801
public int getMfaAuthTimeout() {

perun-base/src/main/java/cz/metacentrum/perun/core/api/PerunPrincipal.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public class PerunPrincipal {
2525
// Specifies if the principal has initialized authZResolver
2626
private volatile boolean authzInitialized = false;
2727
// Keywords of additionalInformations
28-
public static final String MFA_TIMESTAMP = "mfaTimestamp";
28+
public static final String AUTH_TIME = "authTime";
29+
public static final String ACR_MFA = "acrMfa";
2930
public static final String ISSUER = "issuer";
3031
public static final String ACCESS_TOKEN = "accessToken";
3132

perun-base/src/main/java/cz/metacentrum/perun/core/api/RichGroup.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,20 @@ public boolean equals(Object obj) {
112112
return false;
113113
}
114114
if (attributes == null) {
115-
if (other.getAttributes() != null) {
116-
return false;
117-
}
118-
} else if (!this.getAttributes().equals(other.getAttributes())) {
115+
return other.getAttributes() == null;
116+
}
117+
if (this.getAttributes().size() != other.getAttributes().size()) {
119118
return false;
120119
}
121-
return true;
120+
121+
List<Attribute> sortedThis = this.getAttributes().stream()
122+
.sorted()
123+
.toList();
124+
125+
List<Attribute> sortedOther = other.getAttributes().stream()
126+
.sorted()
127+
.toList();
128+
129+
return sortedThis.equals(sortedOther);
122130
}
123131
}

perun-base/src/main/java/cz/metacentrum/perun/core/api/Role.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ public class Role {
3636
public static final String PASSWORDRESETMANAGER = "PASSWORDRESETMANAGER";
3737
public static final String MEMBERSHIP = "MEMBERSHIP";
3838
public static final String MFA = "MFA";
39+
public static final String PROXY = "PROXY";
3940

4041
public static List<String> rolesAsList() {
4142
return Arrays.asList(AUDITCONSUMERADMIN, CABINETADMIN, ENGINE, FACILITYADMIN, FACILITYOBSERVER, TRUSTEDFACILITYADMIN, GROUPADMIN,
4243
GROUPOBSERVER, GROUPMEMBERSHIPMANAGER, MEMBERSHIP, NOTIFICATIONS, PASSWORDRESETMANAGER, PERUNADMIN, PERUNOBSERVER, REGISTRAR, RESOURCEADMIN, RESOURCEOBSERVER,
4344
RESOURCESELFSERVICE, RPC, SECURITYADMIN, SELF, SERVICEUSER, SPREGAPPLICATION, SPONSOR, TOPGROUPCREATOR, UNKNOWNROLENAME,
44-
VOADMIN, VOOBSERVER, SPONSORSHIP, MFA);
45+
VOADMIN, VOOBSERVER, SPONSORSHIP, MFA, PROXY);
4546
}
4647
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package cz.metacentrum.perun.core.api.exceptions;
2+
3+
/**
4+
* This exception is thrown when the form item does not exist in any application form
5+
*
6+
* @author Jakub Hejda <[email protected]>
7+
*/
8+
public class FormItemNotExistsException extends PerunException {
9+
static final long serialVersionUID = 0;
10+
11+
/**
12+
* Simple constructor with a message
13+
* @param message message with details about the cause
14+
*/
15+
public FormItemNotExistsException(String message) {
16+
super(message);
17+
}
18+
19+
/**
20+
* Constructor with a message and Throwable object
21+
* @param message message with details about the cause
22+
* @param cause Throwable that caused throwing of this exception
23+
*/
24+
public FormItemNotExistsException(String message, Throwable cause) {
25+
super(message, cause);
26+
}
27+
28+
/**
29+
* Constructor with a Throwable object
30+
* @param cause Throwable that caused throwing of this exception
31+
*/
32+
public FormItemNotExistsException(Throwable cause) {
33+
super(cause);
34+
}
35+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package cz.metacentrum.perun.core.api.exceptions;
2+
3+
/**
4+
* Exception thrown when relation of two groups as parent-sub should exist, but does not.
5+
*
6+
* @author Dominik Frantisek Bucik <[email protected]>
7+
*/
8+
public class GroupIsNotASubgroupException extends PerunException {
9+
10+
/**
11+
* Constructor without arguments
12+
*/
13+
public GroupIsNotASubgroupException() {}
14+
15+
/**
16+
* Simple constructor with a message
17+
* @param message message with details about the cause
18+
*/
19+
public GroupIsNotASubgroupException(String message) {
20+
super(message);
21+
}
22+
23+
/**
24+
* Constructor with a message and Throwable object
25+
* @param message message with details about the cause
26+
* @param cause Throwable that caused throwing of this exception
27+
*/
28+
public GroupIsNotASubgroupException(String message, Throwable cause) {
29+
super(message, cause);
30+
}
31+
32+
/**
33+
* Constructor with a Throwable object
34+
* @param cause Throwable that caused throwing of this exception
35+
*/
36+
public GroupIsNotASubgroupException(Throwable cause) {
37+
super(cause);
38+
}
39+
}

perun-base/src/main/java/cz/metacentrum/perun/oidc/UserInfoEndpointCall.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import org.apache.commons.lang3.StringUtils;
2121

22-
import static cz.metacentrum.perun.core.api.PerunPrincipal.MFA_TIMESTAMP;
2322

2423
/**
2524
* Class for executing call to User info endpoint.
@@ -35,29 +34,11 @@ public UserInfoEndpointResponse getUserInfoEndpointData(String accessToken, Stri
3534

3635
fillAdditionalInformationWithDataFromUserInfo(userInfo, additionalInformation);
3736

38-
String mfaTimestamp = getMfaTimestamp(userInfo);
39-
if (mfaTimestamp != null && !mfaTimestamp.isEmpty()) {
40-
additionalInformation.put(MFA_TIMESTAMP, mfaTimestamp);
41-
}
42-
4337
String extSourceName = getExtSourceName(userInfo);
4438
String extSourceLogin = getExtSourceLogin(userInfo);
4539
return new UserInfoEndpointResponse(extSourceName, extSourceLogin);
4640
}
4741

48-
/**
49-
* Calls UserInfo endpoint and returns MFA timestamp if available and acr is equal to MFA acr
50-
* @param accessToken access token
51-
* @param issuer issuer
52-
* @throws ExpiredTokenException if access token is expired
53-
* @return mfa timestamp or null
54-
*/
55-
public String getUserInfoEndpointMfaData(String accessToken, String issuer) throws ExpiredTokenException {
56-
JsonNode userInfo = callUserInfo(accessToken, issuer);
57-
58-
return getMfaTimestamp(userInfo);
59-
}
60-
6142
private static JsonNode callUserInfo(String accessToken, String issuer) throws ExpiredTokenException {
6243
RestTemplate restTemplate = new RestTemplate();
6344
JsonNode config = restTemplate.getForObject(issuer + "/.well-known/openid-configuration", JsonNode.class);
@@ -168,22 +149,4 @@ private void fillAdditionalInformationWithDataFromUserInfo(JsonNode userInfo, Ma
168149
additionalInformation.put("sourceIdPName", idpName);
169150
}
170151
}
171-
172-
/**
173-
* Returns mfa timestamp if acr value is equal to MFA acr value
174-
* @param userInfo parsed response from userInfo endpoint
175-
*/
176-
private String getMfaTimestamp(JsonNode userInfo) {
177-
String acrProperty = BeansUtils.getCoreConfig().getUserInfoEndpointAcrPropertyName();
178-
String acr = userInfo.path(acrProperty).asText();
179-
if (StringUtils.isNotEmpty(acr) && acr.equals(BeansUtils.getCoreConfig().getUserInfoEndpointMfaAcrValue())) {
180-
String mfaTimestampProperty = BeansUtils.getCoreConfig().getUserInfoEndpointMfaAuthTimestampPropertyName();
181-
String mfaTimestamp = userInfo.path(mfaTimestampProperty).asText();
182-
if (StringUtils.isNotEmpty(mfaTimestamp)) {
183-
return mfaTimestamp;
184-
}
185-
}
186-
187-
return null;
188-
}
189152
}

perun-base/src/main/java/cz/metacentrum/perun/registrar/model/ApplicationFormItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ public static enum Type {
248248
*/
249249
TIMEZONE,
250250
/**
251-
* Special type for specifying if will be allowed to register to group(s) through VO application form. This type
252-
* is represented by standard HTML checkbox.
251+
* Special type for specifying if it will be allowed to register to group(s) through single application form.
252+
* This type is represented by standard HTML checkbox.
253253
*/
254254
EMBEDDED_GROUP_APPLICATION,
255255
/**

0 commit comments

Comments
 (0)