@ Nullable public OAuthConnection parse ( String email ) { String domain = extractDomain ( email ) ; if ( domain == null ) { return null ; } domain = domain . toLowerCase ( ) ; for ( OAuthConnection c : connections ) { String mainDomain = domainForConnection ( c ) ; if ( domain . equalsIgnoreCase ( mainDomain ) ) { return c ; } List < String > aliases = c . valueForKey ( DOMAIN_ALIASES_KEY , List . class ) ; if ( aliases != null ) { for ( String d : aliases ) { if ( d . equalsIgnoreCase ( domain ) ) { return c ; } } } } return null ; }
Tries to find a valid domain with the given input .