use of it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException in project SEPA by arces-wot.
the class LdapSecurityManager method isAuthorized.
@Override
public boolean isAuthorized(String uid) throws SEPASecurityException {
logger.log(Level.getLevel("ldap"), "[LDAP] isAuthorized " + uid + " uid=" + uid + ",ou=authorizedIdentities," + prop.getBase(), "(objectclass=*)");
bind();
try {
cursor = ldap.search("uid=" + uid + ",ou=authorizedIdentities," + prop.getBase(), "(objectclass=*)", SearchScope.OBJECT, "*");
return cursor.next();
} catch (LdapException | CursorException e) {
logger.error("[LDAP] isAuthorized exception " + e.getMessage());
throw new SEPASecurityException("isAuthorized exception " + e.getMessage());
} finally {
unbind();
}
}
use of it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException in project SEPA by arces-wot.
the class LdapSecurityManager method setUserExpiringPeriod.
@Override
public void setUserExpiringPeriod(long period) throws SEPASecurityException {
logger.log(Level.getLevel("ldap"), "[LDAP] setUserExpiringPeriod " + period + " uid=user,uid=expiring,ou=jwt," + prop.getBase());
bind();
try {
Modification expiring = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "pwdGraceExpire");
ldap.modify("uid=user,uid=expiring,ou=jwt," + prop.getBase(), expiring);
} catch (LdapException e) {
logger.error("setUserExpiringPeriod exception " + e.getMessage());
throw new SEPASecurityException("setUserExpiringPeriod exception " + e.getMessage());
} finally {
unbind();
}
}
use of it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException in project SEPA by arces-wot.
the class LdapSecurityManager method containsCredentials.
@Override
public boolean containsCredentials(String uid) throws SEPASecurityException {
logger.log(Level.getLevel("ldap"), "[LDAP] containsCredentials " + "uid=" + uid + ",ou=credentials," + prop.getBase(), "(objectclass=*)");
bind();
try {
cursor = ldap.search("uid=" + uid + ",ou=credentials," + prop.getBase(), "(objectclass=*)", SearchScope.OBJECT, "*");
return cursor.next();
} catch (LdapException | CursorException e) {
logger.error("[LDAP] checkCredentials exception " + e.getMessage());
throw new SEPASecurityException("checkCredentials exception " + e.getMessage());
} finally {
unbind();
}
}
use of it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException in project SEPA by arces-wot.
the class LdapSecurityManager method setIssuer.
@Override
public void setIssuer(String issuer) throws SEPASecurityException {
logger.log(Level.getLevel("ldap"), "[LDAP] setIssuer " + issuer + " uid=issuer,ou=jwt," + prop.getBase());
bind();
try {
Modification replaceGn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "host", issuer);
ldap.modify("uid=issuer,ou=jwt," + prop.getBase(), replaceGn);
} catch (LdapException e) {
logger.error("[LDAP] setIssuer exception " + e.getMessage());
throw new SEPASecurityException("setIssuer exception " + e.getMessage());
} finally {
unbind();
}
}
use of it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException in project SEPA by arces-wot.
the class LdapSecurityManager method removeJwt.
@Override
public void removeJwt(String uid) throws SEPASecurityException {
logger.log(Level.getLevel("ldap"), "[LDAP] removeToken " + "uid=" + uid + ",ou=tokens," + prop.getBase());
bind();
try {
ldap.delete("uid=" + uid + ",ou=tokens," + prop.getBase());
} catch (LdapException e) {
logger.error("[LDAP] removeToken exception " + e.getMessage());
throw new SEPASecurityException("removeToken exception " + e.getMessage());
} finally {
unbind();
}
}
Aggregations