[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security ...
Shane Bryzak
Shane_Bryzak at symantec.com
Wed Jan 17 08:48:45 EST 2007
User: sbryzak2
Date: 07/01/17 08:48:45
Modified: src/main/org/jboss/seam/security Identity.java
Log:
support for inline authorization checks
Revision Changes Path
1.12 +17 -0 jboss-seam/src/main/org/jboss/seam/security/Identity.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Identity.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/Identity.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Identity.java 10 Jan 2007 02:06:38 -0000 1.11
+++ Identity.java 17 Jan 2007 13:48:45 -0000 1.12
@@ -94,4 +94,21 @@
return false;
}
+
+ /**
+ * Performs an authorization check, based on the specified security expression.
+ *
+ * @param expr The security expression to evaluate
+ * @throws NotLoggedInException Thrown if the user is not authenticated
+ * @throws AuthorizationException if the authorization check fails
+ */
+ public void checkRestriction(String expr)
+ {
+ if (!isLoggedIn())
+ throw new NotLoggedInException();
+
+ if (!SeamSecurityManager.instance().evaluateExpression(expr))
+ throw new AuthorizationException(String.format(
+ "Authorization check failed for expression [%s]", expr));
+ }
}
More information about the jboss-cvs-commits
mailing list