use of com.yahoo.athenz.zpe.AuthZpeClient.AccessCheckStatus in project athenz by yahoo.
the class TestAuthZpe method testPublicFishingAllowedTokenString.
@Test
public void testPublicFishingAllowedTokenString() {
String action = "fish";
String angResource = "angler:stockedpondBigBassLake";
AccessCheckStatus status = AuthZpeClient.allowAccess(rToken0AnglerPublic.getSignedToken(), angResource, action);
Assert.assertEquals(status, AccessCheckStatus.ALLOW);
}
use of com.yahoo.athenz.zpe.AuthZpeClient.AccessCheckStatus in project athenz by yahoo.
the class TestAuthZpe method testAllowAccessMatchEqualDenied.
@Test
public void testAllowAccessMatchEqualDenied() {
String action = "compare";
String resource = "angler:compares";
/* extra s after compare */
StringBuilder roleName = new StringBuilder();
AccessCheckStatus status = AuthZpeClient.allowAccess(rToken0AnglerRegex, resource, action, roleName);
Assert.assertEquals(status, AccessCheckStatus.DENY_NO_MATCH);
}
use of com.yahoo.athenz.zpe.AuthZpeClient.AccessCheckStatus in project athenz by yahoo.
the class TestAuthZpe method testAllowAccessMatchRegexInvalidRange3.
@Test
public void testAllowAccessMatchRegexInvalidRange3() {
String action = "full_regex";
String resource = "angler:coref";
StringBuilder roleName = new StringBuilder();
AccessCheckStatus status = AuthZpeClient.allowAccess(rToken0AnglerRegex, resource, action, roleName);
Assert.assertEquals(status, AccessCheckStatus.DENY_NO_MATCH);
}
use of com.yahoo.athenz.zpe.AuthZpeClient.AccessCheckStatus in project athenz by yahoo.
the class TestAuthZpe method testPublicFishingDenied.
@Test
public void testPublicFishingDenied() {
String action = "fish";
String angResource = "angler:spawningpondLittleBassLake";
StringBuilder roleName = new StringBuilder();
AccessCheckStatus status = AuthZpeClient.allowAccess(rToken0AnglerPublic, angResource, action, roleName);
Assert.assertEquals(status, AccessCheckStatus.DENY);
Assert.assertEquals(roleName.toString(), "public");
}
use of com.yahoo.athenz.zpe.AuthZpeClient.AccessCheckStatus in project athenz by yahoo.
the class TestAuthZpe method testKeyIds.
@Test
public void testKeyIds() {
String action = "read";
StringBuilder roleName = new StringBuilder();
// Test key id 0 on Angler domain
String angResource = "angler:stuff";
AccessCheckStatus status = AuthZpeClient.allowAccess(rToken0AnglerPublic, angResource, action, roleName);
Assert.assertEquals(status, AccessCheckStatus.ALLOW, "rsrc=" + angResource + " act=" + action);
Assert.assertEquals(roleName.toString(), "public");
// Test key id 1 on Sports domain
roleName.setLength(0);
String resource = "sports.NFL_DB";
status = AuthZpeClient.allowAccess(rToken1SportsAdmin, resource, action, roleName);
Assert.assertEquals(status, AccessCheckStatus.ALLOW, "rsrc=" + resource + " act=" + action);
Assert.assertEquals(roleName.toString(), "admin");
}
Aggregations