package com.peterphi.std.guice.common.auth.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthConstraint
{
	/**
	 * The id of this authentication constraint; designed to allow configuration to override the constraints in the annotation
	 *
	 * @return
	 */
	public String id() default "no-id";

	/**
	 * If true, authentication will not be enforced on calls made to the annotation target
	 *
	 * @return
	 */
	public boolean skip() default false;

	/**
	 * The role the user must have (defaults to "user"). If the user does not hold this role then an authentication exception
	 * will
	 * be raised
	 *
	 * @return
	 */
	public String role() default "user";

	/**
	 * The description of this constraint (which can be displayed to users to help explain why they have been denied access)
	 *
	 * @return
	 */
	public String comment() default "";
}

@@ -331,16 +331,49 @@
 raint%0A%7B%0A
+%09String DEFAULT_ID = %22default%22;%0A%0A
 %09/**%0A%09 *
@@ -511,31 +511,24 @@
 eturn%0A%09 */%0A%09
-public 
 String id() 
@@ -539,15 +539,18 @@
 ult 
-%22no-id%22
+DEFAULT_ID
 ;%0A%0A%09
@@ -663,23 +663,16 @@
 n%0A%09 */%0A%09
-public 
 boolean 
@@ -821,20 +821,16 @@
 xception
-%0A%09 *
  will%0A%09 
@@ -859,31 +859,24 @@
 eturn%0A%09 */%0A%09
-public 
 String role(
@@ -1043,23 +1043,16 @@
 n%0A%09 */%0A%09
-public 
 String c

Update AuthConstraint to set the default scope id to 'default', and autoformat code