Minor changes for Organization needs
[aaf/authz.git] / auth / auth-deforg / src / main / java / org / onap / aaf / org / DefaultOrg.java
index fa9b521..2440e02 100644 (file)
@@ -48,7 +48,7 @@ public class DefaultOrg implements Organization {
     final String domain;
     final String atDomain;
     final String realm;
-    
+
     private final String root_ns;
 
     private final String NAME;
@@ -65,7 +65,7 @@ public class DefaultOrg implements Organization {
         atDomain = '@'+domain;
         NAME=env.getProperty(realm + ".name","Default Organization");
         root_ns = env.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF);
-        
+
         try {
             String defFile;
             String temp=env.getProperty(defFile = (getClass().getName()+".file"));
@@ -84,7 +84,7 @@ public class DefaultOrg implements Organization {
                         }
                         fIdentities.createNewFile();
                     }
-                    
+
                 }
             } else {
                 fIdentities = new File(temp);
@@ -122,7 +122,7 @@ public class DefaultOrg implements Organization {
             } else {
                 revoked = null;
             }
-            
+
         } catch (IOException e) {
             throw new OrganizationException(e);
         }
@@ -262,11 +262,11 @@ public class DefaultOrg implements Organization {
     /**
      *  (                # Start of group
      *  (?=.*[a-z,A-Z])    #   must contain one character
-     *  
-     *  (?=.*\d)        #   must contain one digit from 0-9 
+     *
+     *  (?=.*\d)        #   must contain one digit from 0-9
      *        OR
      *  (?=.*[@#$%])    #   must contain one special symbols in the list SPEC_CHARS
-     *  
+     *
      *            .        #     match anything with previous condition checking
      *          {6,20}    #        length at least 6 characters and maximum of 20
      *  )                # End of group
@@ -515,6 +515,10 @@ public class DefaultOrg implements Organization {
                 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);
@@ -637,6 +641,25 @@ public class DefaultOrg implements Organization {
         }
         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) {