diff options
Diffstat (limited to 'auth/auth-deforg/src/main')
-rw-r--r-- | auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java index 5674e247..935f99bf 100644 --- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java +++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java @@ -56,9 +56,12 @@ public class DefaultOrg implements Organization { final String realm; private final String NAME,mailHost,mailFrom; + private final Set<String> supportedRealms; public DefaultOrg(Env env, String realm) throws OrganizationException { this.realm = realm; + supportedRealms=new HashSet<String>(); + supportedRealms.add(realm); domain=FQI.reverseDomain(realm); atDomain = '@'+domain; String s; @@ -668,5 +671,21 @@ public class DefaultOrg implements Organization { return addressArray; } - + private String extractRealm(final String r) { + int at; + if((at=r.indexOf('@'))>=0) { + return FQI.reverseDomain(r.substring(at+1)); + } + return r; + } + @Override + public boolean supportsRealm(final String r) { + return supportedRealms.contains(extractRealm(r)) || r.endsWith(realm); } + + @Override + public synchronized void addSupportedRealm(final String r) { + supportedRealms.add(extractRealm(r)); + } + +} |