Search in sources :

Example 61 with Policy

use of com.yahoo.athenz.zms.Policy in project athenz by yahoo.

the class ZTSTestUtils method createPolicyObject.

public static Policy createPolicyObject(final String domainName, final String policyName, final String roleName, boolean generateRoleName, final String action, final String resource, AssertionEffect effect) {
    Policy policy = new Policy();
    policy.setName(domainName + ":policy." + policyName);
    com.yahoo.athenz.zms.Assertion assertion = new com.yahoo.athenz.zms.Assertion();
    assertion.setAction(action);
    assertion.setEffect(effect);
    assertion.setResource(resource);
    if (generateRoleName) {
        assertion.setRole(domainName + ":role." + roleName);
    } else {
        assertion.setRole(roleName);
    }
    List<Assertion> assertList = new ArrayList<>();
    assertList.add(assertion);
    policy.setAssertions(assertList);
    return policy;
}
Also used : Policy(com.yahoo.athenz.zms.Policy) com.yahoo.athenz.zms(com.yahoo.athenz.zms) Assertion(com.yahoo.athenz.zms.Assertion) Assertion(com.yahoo.athenz.zms.Assertion)

Aggregations

Policy (com.yahoo.athenz.zms.Policy)61 Assertion (com.yahoo.athenz.zms.Assertion)36 Test (org.testng.annotations.Test)34 com.yahoo.athenz.zms (com.yahoo.athenz.zms)25 DataCache (com.yahoo.athenz.zts.cache.DataCache)12 Principal (com.yahoo.athenz.auth.Principal)8 Role (com.yahoo.athenz.zms.Role)8 JDBCConnection (com.yahoo.athenz.zms.store.jdbc.JDBCConnection)7 Domain (com.yahoo.athenz.zms.Domain)6 RoleMember (com.yahoo.athenz.zms.RoleMember)6 ServiceIdentity (com.yahoo.athenz.zms.ServiceIdentity)5 ResourceException (com.yahoo.athenz.zms.ResourceException)4 Struct (com.yahoo.rdl.Struct)4 SQLException (java.sql.SQLException)4 Authority (com.yahoo.athenz.auth.Authority)3 InstanceCertManager (com.yahoo.athenz.zts.cert.InstanceCertManager)3 ArrayList (java.util.ArrayList)3 AuthzDetailsEntity (com.yahoo.athenz.common.config.AuthzDetailsEntity)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2