Beispiel #1
0
 public int checkCrossDomainProxy(
     Mapping.SourceType sourceType, boolean isSsl, String host, int port, String originUrl) {
   boolean isSelf = RealHost.isSelfOrigin(originUrl);
   for (Mapping mapping : activeMappings) {
     if (isSelf == false && mapping.isAllowOrigin(originUrl) == false) {
       continue;
     }
     if (mapping.getSourceType() != sourceType) {
       continue;
     }
     Mapping.SecureType secureType = mapping.getSecureType();
     if (isSsl && secureType == Mapping.SecureType.PLAIN) {
       continue;
     }
     if (!isSsl && secureType == Mapping.SecureType.SSL) {
       continue;
     }
     if (mapping.matchSourceHost(host) && mapping.matchSourcePost(port)) {
       // mapping認証もしくは認証の必要のないMappingはチェックの必要なし
       if (mapping.getRolesList().size() == 0 || mapping.getMappingAuth() != null) {
         return CHECK_MATCH_NO_AUTH;
       } else {
         return CHECK_MATCH_AUTH;
       }
     }
   }
   return CHECK_NOT_MATCH;
 }
Beispiel #2
0
 // authUrlはCookieLocationベースでのチェックを行うため、wsは、http,wssは、httpsとして存在を確認する
 public int checkCrossDomainWebWs(
     Mapping.SourceType sourceType, boolean isSsl, String path, String originUrl) {
   boolean isSelf = RealHost.isSelfOrigin(originUrl);
   for (Mapping mapping : activeMappings) {
     if (isSelf == false && mapping.isAllowOrigin(originUrl) == false) {
       continue;
     }
     if (mapping.getSourceType() != sourceType) {
       continue;
     }
     // TODO ドメインのチェックもすべき
     //			Mapping.SourceType sourceType=mapping.getSourceType();
     //			if(sourceType!=Mapping.SourceType.WEB&&sourceType!=Mapping.SourceType.WS){
     //				continue;
     //			}
     Mapping.SecureType secureType = mapping.getSecureType();
     if (isSsl && secureType == Mapping.SecureType.PLAIN) {
       continue;
     }
     if (!isSsl && secureType == Mapping.SecureType.SSL) {
       continue;
     }
     String sourcePath = mapping.getSourcePath();
     if (path.equals(sourcePath)) {
       // mapping認証もしくは認証の必要のないMappingはチェックの必要なし
       if (mapping.getRolesList().size() == 0 || mapping.getMappingAuth() != null) {
         return CHECK_MATCH_NO_AUTH;
       } else {
         return CHECK_MATCH_AUTH;
       }
     }
   }
   return CHECK_NOT_MATCH;
 }