import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.util.FQI;
import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.org.Identities.Data;
public class DefaultOrg implements Organization {
private static final String AAF_DATA_DIR = "aaf_data_dir";
root_ns = env.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF);
try {
- String defFile;
- String temp=env.getProperty(defFile = (getClass().getName()+".file"));
+ String temp=env.getProperty(realm +".file");
File fIdentities=null;
if (temp==null) {
temp = env.getProperty(AAF_DATA_DIR);
if (temp!=null) {
- env.warn().log(defFile, " is not defined. Using default: ",temp+"/identities.dat");
+ env.warn().log("Datafile for " + realm + " is not defined. Using default: ",temp+"/identities.dat");
File dir = new File(temp);
fIdentities=new File(dir,"identities.dat");
* If the ID isn't in the revoked file, if it exists, it is revoked.
*/
@Override
- public boolean isRevoked(AuthzTrans trans, String key) {
+ public Date isRevoked(AuthzTrans trans, String key) {
if(revoked!=null) {
try {
revoked.open(trans, DefaultOrgIdentity.TIMEOUT);
} else {
search = key;
}
- return revoked.find(search, r)!=null;
+ Data revokedData = revoked.find(search, r);
+ return revokedData==null?null:new Date();
} finally {
revoked.close(trans);
}
trans.error().log(e);
}
}
- return false;
+ return null;
}
/* (non-Javadoc)
now.add(GregorianCalendar.MONTH, 6);
rv = now;
break;
+ case RevokedGracePeriodEnds:
+ now.add(GregorianCalendar.DATE, 3);
+ rv = now;
+ break;
default:
// Unless other wise set, 6 months is default
now.add(GregorianCalendar.MONTH, 6);
}
return false;
}
+
+ @Override
+ public String supportedDomain(String user) {
+ if(user!=null) {
+ int after_at = user.indexOf('@')+1;
+ if(after_at<user.length()) {
+ String ud = FQI.reverseDomain(user);
+ if(ud.startsWith(getDomain())) {
+ return getDomain();
+ }
+ for(String s : supportedRealms) {
+ if(ud.startsWith(s)) {
+ return FQI.reverseDomain(s);
+ }
+ }
+ }
+ }
+ return null;
+ }
@Override
public synchronized void addSupportedRealm(final String r) {
return 0;
}
}
+
+ @Override
+ public boolean isUserExpireExempt(String user, Date expires) {
+ return false;
+ }
}