@AuthEnforce(entities = {"namespace", "dataset"}, enforceOn = DatasetId.class, actions = Action.ADMIN) public void testQueryPathParamAnnotations(@QueryParam("namespace") String namespace, @PathParam("dataset") String dataset) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@VisibleForTesting // NOTE : tests that the presence of other annotations does not affect class rewrite @AuthEnforce(entities = "namespaceId", enforceOn = NamespaceId.class, actions = {Action.ADMIN, Action.READ}) public void testMultipleAction(@Name("namespaceId") NamespaceId namespaceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "namespaceId", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testNameAnnotationPref(@Name("namespaceId") NamespaceId namespaceId, @PathParam("namespaceId") String ns) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); } }
public void testNoAuthEnforceAnnotation(@Name("namespaceId") NamespaceId namespaceId) throws Exception { throw new EnforceNotCalledException(); }
public void methodWithoutAuthEnforce(@Name("namespaceId") NamespaceId namespaceId) throws Exception { throw new EnforceNotCalledException(); } }
@AuthEnforce(entities = "namespaceId", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testSomeOtherAction(@Name("namespaceId") NamespaceId namespaceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); } }
@Override public void interfaceMethodWithAuthEnforce(@Name("namespaceId") NamespaceId namespaceId) throws Exception { throw new EnforceNotCalledException(); } }
@AuthEnforce(entities = {"namespace", "dataset"}, enforceOn = DatasetId.class, actions = Action.ADMIN) public void testMultipleParts(@Name("namespace") String namespace, @Name("dataset") String dataset) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "namespaceId", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testSingleAction(@Name("namespaceId") NamespaceId namespaceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "this.someEntity", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testThisClassPreference(@Name("someEntity") NamespaceId namespaceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); } }
@AuthEnforce(entities = "someEntity", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testParaNameSameAsField(NamespaceId someEntity) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "someEntity", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testNoParameters() throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "namespace", enforceOn = NamespaceId.class, actions = Action.ADMIN) public void testMultipleAnnotationsPref(@Name("namespace") @PathParam("namespaceId") NamespaceId namespaceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }
@AuthEnforce(entities = "someEntity", enforceOn = InstanceId.class, actions = Action.ADMIN) public void testParaPreference(@Name("someEntity") InstanceId instanceId) throws Exception { // the above annotation will call enforce after class rewrite which should throw an exception. // If the line below is reached it means that enforce was not called as it supposed to be throw new EnforceNotCalledException(); }