8000 for #961 implemented using a custom claim updater · TremoloSecurity/OpenUnison@5e57e3c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e57e3c

Browse files
committed
for #961 implemented using a custom claim updater
1 parent c4acd8b commit 5e57e3c

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

unison/unison-applications-k8s/src/main/java/com/tremolosecurity/k8s/util/PortalGroupMapper.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.common.collect.ComparisonChain;
2020
import com.novell.ldap.LDAPAttribute;
2121
import com.novell.ldap.LDAPEntry;
22+
import com.novell.ldap.util.ByteArray;
2223
import com.tremolosecurity.myvd.dataObj.ClusterInfo;
2324
import com.tremolosecurity.myvd.dataObj.RoleInfo;
2425
import com.tremolosecurity.provisioning.core.ProvisioningException;
@@ -142,6 +143,70 @@ public int compare(RoleInfo o1, RoleInfo o2) {
142143
return portalGroupVals;
143144
}
144145

146+
public List<String> getClusterGroups(List<ByteArray> groups,String clusterName) throws ProvisioningException {
147+
HashMap<String, ClusterInfo> clusterAz = new HashMap<>();
148+
List<String> clusterGroups = new ArrayList<String>();
149+
150+
151+
152+
for (ByteArray rawGroup : groups) {
153+
String group = rawGroup.toString();
154+
RoleInfo ri = this.roles.get(group);
155+
if (ri == null) {
156+
157+
ri = this.loadRoleInfo(group);
158+
159+
160+
161+
162+
163+
164+
}
165+
166+
167+
168+
ClusterInfo cluster = clusterAz.get(ri.getCluster());
169+
if (cluster == null) {
170+
cluster = new ClusterInfo(ri.getCluster());
171+
clusterAz.put(ri.getCluster(), cluster);
172+
}
173+
174+
cluster.getGroups().add(group);
175+
176+
Map<String, Integer> ns = cluster.getNamespaces().get(ri.getNamespace());
177+
if (ns == null) {
178+
ns = new HashMap<String, Integer>();
179+
cluster.getNamespaces().put(ri.getNamespace(), ns);
180+
}
181+
ns.put(ri.getName(), 1);
182+
183+
184+
185+
186+
ClusterInfo clusterInfo = clusterAz.get("N/A");
187+
logger.info("clusterInfo NA : " + clusterInfo);
188+
if (clusterInfo != null) {
189+
190+
clusterGroups.addAll(clusterInfo.getGroups());
191+
}
192+
193+
clusterInfo = clusterAz.get(clusterName);
194+
logger.info("clusterInfo : " + clusterInfo);
195+
if (clusterInfo != null) {
196+
clusterGroups.addAll(clusterInfo.getGroups());
197+
}
198+
199+
200+
201+
}
202+
203+
204+
205+
206+
207+
return clusterGroups;
208+
}
209+
145210
public List<String> generateMappings(LDAPEntry entry) throws ProvisioningException {
146211
JSONArray portalGroupVals = new JSONArray();
147212
List<RoleInfo> sortedRoles = new ArrayList<RoleInfo>();

unison/unison-idp-openidconnect/src/main/java/com/tremolosecurity/idp/providers/OpenIDConnectIdP.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ private void completeFederation(HttpServletRequest request,
19411941

19421942

19431943
if (! authInfo.isAuthComplete()) {
1944-
logger.warn("Attempted completetd federation before autthentication is completeed, clearing authentication and redirecting to the original URL");
1944+
logger.warn("Attempted completetd federation before authentication is completed, clearing authentication and redirecting to the original URL");
19451945

19461946
UrlHolder holder = (UrlHolder) request.getAttribute(ProxyConstants.AUTOIDM_CFG);
19471947
request.getSession().removeAttribute(ProxyConstants.AUTH_CTL);

0 commit comments

Comments
 (0)
0