X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=inline;f=security%2Fimpl%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsecurity%2Fauthorization%2FUrlAuthorizationRule.java;h=8e9d1353be37aeffee066ddd55cf1a189f3e3b35;hb=43995978f8779ea9fb686e8cb6f98516d8c2f2e5;hp=0ae744c464215ff0584e4da4a12683ef42751df1;hpb=597a78e0a77c32cb022f2815211c07ac5f4d68bb;p=utils
diff --git a/security/impl/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java b/security/impl/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java
index 0ae744c4..8e9d1353 100644
--- a/security/impl/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java
+++ b/security/impl/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java
@@ -15,6 +15,9 @@
*/
package org.wamblee.security.authorization;
+import static org.wamblee.security.authorization.AuthorizationResult.*;
+
+import javax.enterprise.inject.Typed;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
@@ -23,17 +26,11 @@ import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
import javax.persistence.Transient;
import org.apache.log4j.Logger;
-
-import static org.wamblee.security.authorization.AuthorizationResult.DENIED;
-import static org.wamblee.security.authorization.AuthorizationResult.GRANTED;
-import static org.wamblee.security.authorization.AuthorizationResult.UNDECIDED;
-import static org.wamblee.security.authorization.AuthorizationResult.UNSUPPORTED_RESOURCE;
-
-import org.wamblee.security.AbstractPersistent;
-import org.wamblee.usermgt.User;
+import org.wamblee.security.authentication.User;
/**
* Utility base class for implementation of authentication rules based on the
@@ -41,12 +38,12 @@ import org.wamblee.usermgt.User;
*
The path of the resource. To obtain the path of a resource, subclasses
* must implement {@link #getResourcePath(Object)}. Whether a path is
* appropriate is determined by a
- * {@link org.wamblee.security.authorization.PathCondition}.
+ * {@link org.wamblee.security.authorization.AbstractPathCondition}.
* The user identity with which the resource is accessed. Whether a user is
* appropriate is determined by a
- * {@link org.wamblee.security.authorization.UserCondition}.
+ * {@link org.wamblee.security.authorization.AbstractUserCondition}.
* The operation that is requested. Whether the operation is appropriate is
- * determined by a {@link org.wamblee.security.authorization.OperationCondition}
+ * determined by a {@link org.wamblee.security.authorization.AbstractOperationCondition}
* .
*
* In case all three conditions match, the condition returns the configured
@@ -56,7 +53,7 @@ import org.wamblee.usermgt.User;
*/
@Entity
@Access(AccessType.PROPERTY)
-public abstract class UrlAuthorizationRule extends AuthorizationRule {
+public abstract class UrlAuthorizationRule extends AbstractAuthorizationRule {
private static final Logger LOGGER = Logger
.getLogger(UrlAuthorizationRule.class);
@@ -83,6 +80,7 @@ public abstract class UrlAuthorizationRule extends AuthorizationRule {
/**
* Operation that this rule is for.
*/
+
private OperationCondition operationCondition;
/**
@@ -267,7 +265,7 @@ public abstract class UrlAuthorizationRule extends AuthorizationRule {
*
* @return Returns the operationCondition.
*/
- @ManyToOne(cascade = CascadeType.ALL)
+ @OneToOne(cascade = CascadeType.ALL, targetEntity = AbstractOperationCondition.class, orphanRemoval = true)
@JoinColumn(name = "OPER_COND_PK")
public OperationCondition getOperationCondition() {
return operationCondition;
@@ -286,7 +284,7 @@ public abstract class UrlAuthorizationRule extends AuthorizationRule {
*
* @return Returns the pathCondition.
*/
- @ManyToOne(cascade = CascadeType.ALL)
+ @OneToOne(cascade = CascadeType.ALL, targetEntity = AbstractPathCondition.class, orphanRemoval = true)
@JoinColumn(name = "PATH_COND_PK")
public PathCondition getPathCondition() {
return pathCondition;
@@ -305,7 +303,7 @@ public abstract class UrlAuthorizationRule extends AuthorizationRule {
*
* @return Returns the userCondition.
*/
- @ManyToOne(cascade = CascadeType.ALL)
+ @OneToOne(cascade = CascadeType.ALL, targetEntity = AbstractUserCondition.class, orphanRemoval = true)
@JoinColumn(name = "USER_COND_PK")
public UserCondition getUserCondition() {
return userCondition;