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 4, 2022
2 parents 113a8b3 + eeed432 commit d705ba8
Show file tree
Hide file tree
Showing 76 changed files with 1,619 additions and 151 deletions.
108 changes: 108 additions & 0 deletions perun-base/src/main/java/cz/metacentrum/perun/core/api/OidcConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package cz.metacentrum.perun.core.api;

import java.util.Objects;

public class OidcConfig {

private String clientId;
private String oidcDeviceCodeUri;
private String oidcTokenEndpointUri;
private String oidcTokenRevokeEndpointUri;
private String acrValues;
private String scopes;
private String perunApiEndpoint;
private boolean enforceMfa;

public OidcConfig() {}
public String getClientId() {
return clientId;
}

public void setClientId(String clientId) {
this.clientId = clientId;
}

public String getOidcDeviceCodeUri() {
return oidcDeviceCodeUri;
}

public void setOidcDeviceCodeUri(String oidcDeviceCodeUri) {
this.oidcDeviceCodeUri = oidcDeviceCodeUri;
}

public String getOidcTokenEndpointUri() {
return oidcTokenEndpointUri;
}

public void setOidcTokenEndpointUri(String oidcTokenEndpointUri) {
this.oidcTokenEndpointUri = oidcTokenEndpointUri;
}

public String getOidcTokenRevokeEndpointUri() {
return oidcTokenRevokeEndpointUri;
}

public void setOidcTokenRevokeEndpointUri(String oidcTokenRevokeEndpointUri) {
this.oidcTokenRevokeEndpointUri = oidcTokenRevokeEndpointUri;
}

public String getAcrValues() {
return acrValues;
}

public void setAcrValues(String acrValues) {
this.acrValues = acrValues;
}

public String getScopes() {
return scopes;
}

public void setScopes(String scopes) {
this.scopes = scopes;
}

public String getPerunApiEndpoint() {
return perunApiEndpoint;
}

public void setPerunApiEndpoint(String perunApiEndpoint) {
this.perunApiEndpoint = perunApiEndpoint;
}

public boolean getEnforceMfa() {
return enforceMfa;
}

public void setEnforceMfa(boolean enforceMfa) {
this.enforceMfa = enforceMfa;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OidcConfig that = (OidcConfig) o;
return Objects.equals(getClientId(), that.getClientId()) && Objects.equals(getOidcDeviceCodeUri(), that.getOidcDeviceCodeUri()) && Objects.equals(getOidcTokenEndpointUri(), that.getOidcTokenEndpointUri()) && Objects.equals(getOidcTokenRevokeEndpointUri(), that.getOidcTokenRevokeEndpointUri())
&& Objects.equals(getPerunApiEndpoint(), that.getPerunApiEndpoint()) && Objects.equals(getAcrValues(), that.getAcrValues()) && Objects.equals(getScopes(), that.getScopes()) && Objects.equals(getEnforceMfa(), that.getEnforceMfa());
}

@Override
public int hashCode() {
return Objects.hash(getClientId(), getOidcDeviceCodeUri(), getOidcTokenEndpointUri(), getOidcTokenRevokeEndpointUri(), getPerunApiEndpoint(), getAcrValues(), getScopes(), getEnforceMfa());
}

@Override
public String toString() {
return "OidcConfig{" +
"clientId='" + clientId + '\'' +
", oidcDeviceCodeUri='" + oidcDeviceCodeUri + '\'' +
", oidcTokenEndpointUri='" + oidcTokenEndpointUri + '\'' +
", oidcTokenRevokeEndpointUri='" + oidcTokenRevokeEndpointUri + '\'' +
", acrValues='" + acrValues + '\'' +
", scopes='" + scopes + '\'' +
", perunApiEndpoint='" + perunApiEndpoint + '\'' +
", enforceMfa='" + enforceMfa + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* assignableToAttributes is a flag that determines whether the role can appear in attribute policies.
* skipMFA is a flag that whether the role should skip MFA check.
* mfaCriticalRole is a flag marking roles always requiring MFA from users having that role
* displayName is a more user-friendly name
*/
public class RoleManagementRules {

Expand All @@ -48,7 +49,9 @@ public class RoleManagementRules {
private boolean skipMFA;
private boolean mfaCriticalRole;

public RoleManagementRules(String roleName, String primaryObject, List<Map<String, String>> privilegedRolesToManage, List<Map<String, String>> privilegedRolesToRead, Map<String, String> entitiesToManage, Map<String, String> assignedObjects, List<Map<String, String>> assignmentCheck, List<String> associatedReadRoles, boolean assignableToAttributes, boolean skipMFA, boolean mfaCriticalRole) {
private String displayName;

public RoleManagementRules(String roleName, String primaryObject, List<Map<String, String>> privilegedRolesToManage, List<Map<String, String>> privilegedRolesToRead, Map<String, String> entitiesToManage, Map<String, String> assignedObjects, List<Map<String, String>> assignmentCheck, List<String> associatedReadRoles, boolean assignableToAttributes, boolean skipMFA, boolean mfaCriticalRole, String displayName) {
this.roleName = roleName;
this.primaryObject = primaryObject;
this.privilegedRolesToManage = privilegedRolesToManage;
Expand All @@ -60,6 +63,7 @@ public RoleManagementRules(String roleName, String primaryObject, List<Map<Strin
this.assignableToAttributes = assignableToAttributes;
this.skipMFA = skipMFA;
this.mfaCriticalRole = mfaCriticalRole;
this.displayName = displayName;
}

public String getRoleName() {
Expand Down Expand Up @@ -150,6 +154,14 @@ public void setMfaCriticalRole(boolean mfaCriticalRole) {
this.mfaCriticalRole = mfaCriticalRole;
}

public String getDisplayName() {
return displayName;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -165,12 +177,13 @@ public boolean equals(Object o) {
Objects.equals(associatedReadRoles, that.associatedReadRoles) &&
Objects.equals(assignableToAttributes, that.assignableToAttributes) &&
Objects.equals(skipMFA, that.skipMFA) &&
Objects.equals(mfaCriticalRole, that.mfaCriticalRole);
Objects.equals(mfaCriticalRole, that.mfaCriticalRole) &&
Objects.equals(displayName, that.displayName);
}

@Override
public int hashCode() {
return Objects.hash(roleName, primaryObject, privilegedRolesToManage, privilegedRolesToRead, entitiesToManage, assignedObjects, assignmentCheck, associatedReadRoles, assignableToAttributes, skipMFA, mfaCriticalRole);
return Objects.hash(roleName, primaryObject, privilegedRolesToManage, privilegedRolesToRead, entitiesToManage, assignedObjects, assignmentCheck, associatedReadRoles, assignableToAttributes, skipMFA, mfaCriticalRole, displayName);
}

@Override
Expand All @@ -187,6 +200,7 @@ public String toString() {
", assignableToAttributes=" + assignableToAttributes +
", skipMFA=" + skipMFA +
", mfaCriticalRole=" + mfaCriticalRole +
", displayName=" + displayName +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cz.metacentrum.perun.core.api;

import java.util.List;
import java.util.Objects;

/**
Expand All @@ -19,6 +20,7 @@ public class UsersPageQuery {
private Integer facilityId;
private Integer serviceId;
private boolean onlyAllowed = false;
private List<ConsentStatus> consentStatuses;

public UsersPageQuery() {}

Expand Down Expand Up @@ -97,6 +99,20 @@ public UsersPageQuery(int pageSize, int offset, SortingOrder order, UsersOrderCo
this.resourceId = resourceId;
this.onlyAllowed = onlyAllowed;
}
public UsersPageQuery(int pageSize, int offset, SortingOrder order, UsersOrderColumn sortColumn, String searchString, Integer facilityId, Integer voId, Integer serviceId, Integer resourceId, boolean onlyAllowed, List<ConsentStatus> consentStatuses) {
this.pageSize = pageSize;
this.offset = offset;
this.order = order;
this.sortColumn = sortColumn;
this.searchString = searchString;
this.facilityId = facilityId;
this.serviceId = serviceId;
this.voId = voId;
this.resourceId = resourceId;
this.onlyAllowed = onlyAllowed;
this.consentStatuses = consentStatuses;
}


public int getPageSize() {
return pageSize;
Expand Down Expand Up @@ -186,6 +202,15 @@ public void setServiceId(Integer serviceId) {
this.serviceId = serviceId;
}


public List<ConsentStatus> getConsentStatuses() {
return consentStatuses;
}

public void setConsentStatuses(List<ConsentStatus> consentStatuses) {
this.consentStatuses = consentStatuses;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -203,6 +228,7 @@ public boolean equals(Object o) {
if (!Objects.equals(voId, that.voId)) return false;
if (!Objects.equals(resourceId, that.resourceId)) return false;
if (!Objects.equals(serviceId, that.serviceId)) return false;
if (!Objects.equals(consentStatuses, that.consentStatuses)) return false;
return Objects.equals(facilityId, that.facilityId);
}

Expand All @@ -218,6 +244,7 @@ public int hashCode() {
result = 31 * result + (resourceId != null ? resourceId.hashCode() : 0);
result = 31 * result + (facilityId != null ? facilityId.hashCode() : 0);
result = 31 * result + (serviceId != null ? serviceId.hashCode() : 0);
result = 31 * result + (consentStatuses != null ? consentStatuses.hashCode() : 0);
result = 31 * result + (onlyAllowed ? 1 : 0);
return result;
}
Expand Down
Loading

0 comments on commit d705ba8

Please sign in to comment.