@Override public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", name=<").append(getName() == null ? "\\0" : BeansUtils.createEscaping(getName())).append(">").append( ", type=<").append(getType() == null ? "\\0" : BeansUtils.createEscaping(getType())).append(">").append( ']').toString(); }
@Override public int compareTo(PerunBean perunBean) { if(perunBean == null) throw new NullPointerException("PerunBean to compare with is null."); if(perunBean instanceof ExtSource) { ExtSource extSource = (ExtSource) perunBean; int compare; //Compare on last Name if (this.getName()== null && extSource.getName() != null) compare = -1; else if (extSource.getName() == null && this.getName() != null) compare = 1; else if (this.getName() == null && extSource.getName() == null) compare = 0; else compare = this.getName().compareToIgnoreCase(extSource.getName()); if(compare != 0) return compare; //Compare on type if (this.getType()== null && extSource.getType() != null) compare = -1; else if (extSource.getType() == null && this.getType() != null) compare = 1; else if (this.getType()== null && extSource.getType() == null) compare = 0; else compare = this.getType().compareToIgnoreCase(extSource.getType()); if(compare != 0) return compare; //Compare to id if not return (this.getId() - perunBean.getId()); } else { return (this.getId() - perunBean.getId()); } } }
for (UserExtSource es : ues) { if (es.getExtSource().getName().equalsIgnoreCase("LDAPMU")) { } else if (es.getExtSource().getName().equalsIgnoreCase("https://idp2.ics.muni.cz/idp/shibboleth")){ authorId = es.getLogin().substring(0, es.getLogin().indexOf("@")); // get only UCO from UCO@mail.muni.cz break;
} else if (ues.getExtSource().getType().equals(ExtSourcesManagerEntry.EXTSOURCE_IDP)) { if (ues.getExtSource().getName().equals("https://extidp.cesnet.cz/idp/shibboleth")) {
@Override public void canBeApproved(PerunSession session, Application app) throws PerunException { // check if submitted from trusted IdP if (!Objects.equals("https://www.structuralbiology.eu/idp/shibboleth", app.getExtSourceName())) { // submitted by untrusted IdP PerunBl perun = (PerunBl) session.getPerun(); User user = null; // check if user is known if (app.getUser() != null) { user = app.getUser(); } else { try { user = perun.getUsersManagerBl().getUserByExtSourceNameAndExtLogin(session, app.getExtSourceName(), app.getCreatedBy()); } catch (Exception ex) { // unable to find user -> untrusted IdP throw new CantBeApprovedException("Application can't be approved automatically. User doesn't have identity from \"www.structuralbiology.eu\". Please check users identity before manual/force approval.", "", "", "", true); } } List<UserExtSource> ueses = perun.getUsersManagerBl().getUserExtSources(session, user); for (UserExtSource ues : ueses) { if (Objects.equals("https://www.structuralbiology.eu/idp/shibboleth", ues.getExtSource().getName())) { // user has trusted identity return; } } throw new CantBeApprovedException("Application can't be approved automatically. User doesn't have identity from \"www.structuralbiology.eu\". Please check users identity before manual/force approval.", "", "", "", true); } // submitted from trusted IdP }
" and a.created_by=? and a.extsourcename=? and a.extsourcetype=?", APP_MAPPER, vo.getId(), AppState.VERIFIED.toString(), ue.getLogin(), ue.getExtSource().getName(), ue.getExtSource().getType());