summaryrefslogtreecommitdiffstats
path: root/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java
diff options
context:
space:
mode:
Diffstat (limited to 'authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java')
-rw-r--r--authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java177
1 files changed, 0 insertions, 177 deletions
diff --git a/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java b/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java
deleted file mode 100644
index df7222b8..00000000
--- a/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.att.authz.service.validation;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.att.authz.cadi.DirectAAFLur.PermPermission;
-import com.att.authz.env.AuthzTrans;
-import com.att.authz.layer.Result;
-import com.att.authz.org.Organization;
-import com.att.dao.aaf.cass.CredDAO;
-import com.att.dao.aaf.cass.DelegateDAO;
-import com.att.dao.aaf.cass.Namespace;
-import com.att.dao.aaf.cass.PermDAO;
-import com.att.dao.aaf.cass.RoleDAO;
-import com.att.dao.aaf.cass.UserRoleDAO;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.authz.service.validation.Validator;
-
-public class JU_Validator {
-
- @Before
- public void setUp(){
- Validator validator = new Validator();
- }
-
-
- @Test
- public void test() {
- assertTrue(Validator.ACTION_CHARS.matcher("HowdyDoody").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("Howd?yDoody").matches());
- assertTrue(Validator.ACTION_CHARS.matcher("_HowdyDoody").matches());
- assertTrue(Validator.INST_CHARS.matcher("HowdyDoody").matches());
- assertFalse(Validator.INST_CHARS.matcher("Howd?yDoody").matches());
- assertTrue(Validator.INST_CHARS.matcher("_HowdyDoody").matches());
-
- //
- assertTrue(Validator.ACTION_CHARS.matcher("*").matches());
- assertTrue(Validator.INST_CHARS.matcher("*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":*:*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":*:*").matches());
-
- assertFalse(Validator.ACTION_CHARS.matcher(":hello").matches());
- assertTrue(Validator.INST_CHARS.matcher(":hello").matches());
- assertFalse(Validator.INST_CHARS.matcher("hello:").matches());
- assertFalse(Validator.INST_CHARS.matcher("hello:d").matches());
-
- assertFalse(Validator.ACTION_CHARS.matcher(":hello:*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":hello:*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":hello:d*:*").matches());
- assertFalse(Validator.INST_CHARS.matcher(":hello:d*d:*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":hello:d*:*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("HowdyDoody*").matches());
- assertFalse(Validator.INST_CHARS.matcher("Howdy*Doody").matches());
- assertTrue(Validator.INST_CHARS.matcher("HowdyDoody*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("*HowdyDoody").matches());
- assertFalse(Validator.INST_CHARS.matcher("*HowdyDoody").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":h*").matches());
- assertFalse(Validator.INST_CHARS.matcher(":h*h*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":h*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":h:h*:*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":h:h*:*").matches());
- assertFalse(Validator.INST_CHARS.matcher(":h:h*h:*").matches());
- assertFalse(Validator.INST_CHARS.matcher(":h:h*h*:*").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":h:*:*h").matches());
- assertFalse(Validator.INST_CHARS.matcher(":h:*:*h").matches());
- assertTrue(Validator.INST_CHARS.matcher(":com.test.*:ns:*").matches());
-
-
- assertFalse(Validator.ACTION_CHARS.matcher("1234+235gd").matches());
- assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd").matches());
- assertTrue(Validator.ACTION_CHARS.matcher("1234-23_5gd").matches());
- assertTrue(Validator.ACTION_CHARS.matcher("1234-235g,d").matches());
- assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd(Version12)").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("1234-23 5gd").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("1234-235gd ").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(" 1234-235gd").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(" ").matches());
-
- // Allow % and = (Needed for Escaping & Base64 usages) jg
- assertTrue(Validator.ACTION_CHARS.matcher("1234%235g=d").matches());
- assertFalse(Validator.ACTION_CHARS.matcher(":1234%235g=d").matches());
- assertTrue(Validator.INST_CHARS.matcher("1234%235g=d").matches());
- assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d").matches());
- assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:%20==").matches());
- assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:=%23").matches());
- assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:*:=%23").matches());
- assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:*").matches());
- assertTrue(Validator.INST_CHARS.matcher(":*:==%20:*").matches());
-
- // Allow / instead of : (more natural instance expression) jg
- assertFalse(Validator.INST_CHARS.matcher("1234/a").matches());
- assertTrue(Validator.INST_CHARS.matcher("/1234/a").matches());
- assertTrue(Validator.INST_CHARS.matcher("/1234/*/a/").matches());
- assertTrue(Validator.INST_CHARS.matcher("/1234//a").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("1234/a").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("/1234/*/a/").matches());
- assertFalse(Validator.ACTION_CHARS.matcher("1234//a").matches());
-
-
- assertFalse(Validator.INST_CHARS.matcher("1234+235gd").matches());
- assertTrue(Validator.INST_CHARS.matcher("1234-235gd").matches());
- assertTrue(Validator.INST_CHARS.matcher("1234-23_5gd").matches());
- assertTrue(Validator.INST_CHARS.matcher("1234-235g,d").matches());
- assertTrue(Validator.INST_CHARS.matcher("m1234@shb.dd.com").matches());
- assertTrue(Validator.INST_CHARS.matcher("1234-235gd(Version12)").matches());
- assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
- assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
- assertFalse(Validator.INST_CHARS.matcher("").matches());
-
-
- for( char c=0x20;c<0x7F;++c) {
- boolean b;
- switch(c) {
- case '?':
- case '|':
- case '*':
- continue; // test separately
- case '~':
- case ',':
- b = false;
- break;
- default:
- b=true;
- }
- }
-
- assertFalse(Validator.ID_CHARS.matcher("abc").matches());
- assertFalse(Validator.ID_CHARS.matcher("").matches());
- assertTrue(Validator.ID_CHARS.matcher("abc@att.com").matches());
- assertTrue(Validator.ID_CHARS.matcher("ab-me@att.com").matches());
- assertTrue(Validator.ID_CHARS.matcher("ab-me_.x@att._-com").matches());
-
- assertFalse(Validator.NAME_CHARS.matcher("ab-me_.x@att._-com").matches());
- assertTrue(Validator.NAME_CHARS.matcher("ab-me").matches());
- assertTrue(Validator.NAME_CHARS.matcher("ab-me_.xatt._-com").matches());
-
-
- // 7/22/2016
- assertTrue(Validator.INST_CHARS.matcher(
- "/!com.att.*/role/write").matches());
- assertTrue(Validator.INST_CHARS.matcher(
- ":!com.att.*:role:write").matches());
-
- }
-
-}