public ScopeDescription getInternalScope(String p_scopeId) { try { final Filter filter = Filter.create( String.format("&(oxType=%s)(oxId=%s)", UmaScopeType.INTERNAL.getValue(), p_scopeId)); final List<ScopeDescription> entries = ldapEntryManager.findEntries(baseDn(), ScopeDescription.class, filter); if (entries != null && !entries.isEmpty()) { // if more then one scope then it's problem, non-deterministic behavior, id must be unique if (entries.size() > 1) { log.error("Found more then one internal uma scope by input id: {0}" + p_scopeId); for (ScopeDescription s : entries) { log.error("Scope, Id: {0}, dn: {1}", s.getId(), s.getDn()); } } return entries.get(0); } } catch (Exception e) { log.error(e.getMessage(), e); } return null; }
private static String getInternalScopeUrl(ScopeDescription internalScope) { if (internalScope != null && internalScope.getType() == InternalExternal.INTERNAL) { return getScopeEndpoint() + "/" + internalScope.getId(); } return ""; }