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=c2834935a473d3967228cad0379e02fc582468b1;hpb=1092f4c2e75cabd49c41a087f9dc67cd966d11fa;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 c2834935..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
@@ -17,17 +17,20 @@ 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;
import javax.persistence.Column;
+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 org.wamblee.usermgt.User;
+import org.wamblee.security.authentication.User;
/**
* Utility base class for implementation of authentication rules based on the
@@ -35,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
@@ -50,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);
@@ -77,6 +80,7 @@ public abstract class UrlAuthorizationRule extends AuthorizationRule {
/**
* Operation that this rule is for.
*/
+
private OperationCondition operationCondition;
/**
@@ -261,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;
@@ -280,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;
@@ -299,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;