You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2012/03/28 00:06:39 UTC
[2/5] DELTASPIKE-127 credential based authentication
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secured.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secured.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secured.java
new file mode 100644
index 0000000..6d2b46e
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secured.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.api.authorization.annotation;
+
+import org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;
+
+import javax.enterprise.util.Nonbinding;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Interceptor for securing beans.
+ * It's also possible to use it as meta-annotation for type-safe view-configs.
+ */
+@Target({ TYPE, METHOD, ANNOTATION_TYPE })
+@Retention(RUNTIME)
+@Documented
+
+//cdi annotations
+@SecurityBindingType
+public @interface Secured
+{
+ /**
+ * {@link AccessDecisionVoter}s which will be invoked before accessing the intercepted instance or in case of
+ * view-configs before a view gets used.
+ *
+ * @return the configured access-decision-voters which should be used for the voting process
+ */
+ @Nonbinding
+ Class<? extends AccessDecisionVoter>[] value();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secures.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secures.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secures.java
new file mode 100644
index 0000000..53005b3
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/Secures.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.deltaspike.security.api.authorization.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to delegate a method as the provider for a specific authorization check
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Secures
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/SecurityBindingType.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/SecurityBindingType.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/SecurityBindingType.java
new file mode 100644
index 0000000..3fabb21
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/annotation/SecurityBindingType.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.deltaspike.security.api.authorization.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Applied to an annotation to indicate that it is a security binding type
+ *
+ * @author Shane Bryzak
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface SecurityBindingType
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/Credential.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/Credential.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/Credential.java
new file mode 100644
index 0000000..bfad55c
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/Credential.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.api.credential;
+
+/**
+ * Contains a single credential, such as a password
+ */
+public interface Credential<T>
+{
+ T getValue();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/LoginCredential.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/LoginCredential.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/LoginCredential.java
new file mode 100644
index 0000000..3d57f7e
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/credential/LoginCredential.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.api.credential;
+
+/**
+ * Represents the credentials the current user will use to authenticate
+ * Only valid during the authentication process
+ */
+public interface LoginCredential
+{
+ String getUserId();
+
+ void setUserId(String userId);
+
+ Credential getCredential();
+
+ void setCredential(Credential credential);
+
+ void invalidate();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AlreadyLoggedInEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AlreadyLoggedInEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AlreadyLoggedInEvent.java
deleted file mode 100644
index b47c2d6..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AlreadyLoggedInEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is fired when an already authenticated user attempts to authenticate again
- */
-public class AlreadyLoggedInEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AuthorizationCheckEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AuthorizationCheckEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AuthorizationCheckEvent.java
deleted file mode 100644
index 6d8cd7a..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/AuthorizationCheckEvent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-/**
- * This event may be used to perform an authorization check. The constructor
- * should be provided with one or more annotation literal values representing the
- * security binding types to be checked. After firing the event, the isPassed()
- * method should be used to determine whether the authorization check was
- * successful.
- * <p/>
- * WARNING - This event should only be fired and observed synchronously.
- * Unpredictable results may occur otherwise.
- */
-public class AuthorizationCheckEvent
-{
- private boolean passed;
-
- private List<? extends Annotation> bindings;
-
- public AuthorizationCheckEvent(List<? extends Annotation> bindings)
- {
- this.bindings = bindings;
- }
-
- public List<? extends Annotation> getBindings()
- {
- return bindings;
- }
-
- public void setPassed(boolean value)
- {
- this.passed = value;
- }
-
- public boolean isPassed()
- {
- return passed;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsInitializedEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsInitializedEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsInitializedEvent.java
deleted file mode 100644
index f01cf66..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsInitializedEvent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-import org.apache.deltaspike.security.api.Credentials;
-
-/**
- * This event is raised when credentials are initialized
- *
- */
-public class CredentialsInitializedEvent
-{
- private Credentials credentials;
-
- public CredentialsInitializedEvent(Credentials credentials)
- {
- this.credentials = credentials;
- }
-
- public Credentials getCredentials()
- {
- return credentials;
- }
-
- public void setCredentials(Credentials credentials)
- {
- this.credentials = credentials;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsUpdatedEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsUpdatedEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsUpdatedEvent.java
deleted file mode 100644
index 3445734..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/CredentialsUpdatedEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised when credentials are updated
- *
- */
-public class CredentialsUpdatedEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/DeferredAuthenticationEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/DeferredAuthenticationEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/DeferredAuthenticationEvent.java
deleted file mode 100644
index 118c9fe..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/DeferredAuthenticationEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event should be fired when a deferred authentication process has completed
- *
- */
-public class DeferredAuthenticationEvent
-{
-
- private boolean success = false;
-
- public DeferredAuthenticationEvent(boolean success)
- {
- this.success = success;
- }
-
- public boolean isSuccess()
- {
- return success;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoggedInEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoggedInEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoggedInEvent.java
deleted file mode 100644
index 00dc389..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoggedInEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-import org.apache.deltaspike.security.api.User;
-
-/**
- * This event is raised when user successfully logs in.
- */
-public class LoggedInEvent
-{
- private User user;
-
- public LoggedInEvent(User user)
- {
- this.user = user;
- }
-
- public User getUser()
- {
- return user;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoginFailedEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoginFailedEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoginFailedEvent.java
deleted file mode 100644
index ba20a79..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/LoginFailedEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is fired when an authentication attempt fails
- */
-public class LoginFailedEvent
-{
- private Exception loginException;
-
- public LoginFailedEvent(Exception loginException)
- {
- this.loginException = loginException;
- }
-
- public Exception getLoginException()
- {
- return loginException;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotAuthorizedEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotAuthorizedEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotAuthorizedEvent.java
deleted file mode 100644
index 214a296..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotAuthorizedEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised when the user is not authorized to perform an operation
- */
-public class NotAuthorizedEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotLoggedInEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotLoggedInEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotLoggedInEvent.java
deleted file mode 100644
index ec269cc..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/NotLoggedInEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised when an unauthenticated user attempts to performed a privileged operation
- */
-public class NotLoggedInEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostAuthenticateEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostAuthenticateEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostAuthenticateEvent.java
deleted file mode 100644
index 665be30..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostAuthenticateEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised just after authentication
- */
-public class PostAuthenticateEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostLoggedOutEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostLoggedOutEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostLoggedOutEvent.java
deleted file mode 100644
index 99f5152..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PostLoggedOutEvent.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.api.events;
-
-import org.apache.deltaspike.security.api.User;
-
-/**
- * This event is raised just after the user un-authenticates
- */
-public class PostLoggedOutEvent
-{
- private User user;
-
- public PostLoggedOutEvent(User user)
- {
- this.user = user;
- }
-
- public User getUser()
- {
- return user;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreAuthenticateEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreAuthenticateEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreAuthenticateEvent.java
deleted file mode 100644
index 80cd215..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreAuthenticateEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised just before authentication.
- */
-public class PreAuthenticateEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreLoggedOutEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreLoggedOutEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreLoggedOutEvent.java
deleted file mode 100644
index d901794..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/PreLoggedOutEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised just before the user un-authenticates
- */
-public class PreLoggedOutEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/QuietLoginEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/QuietLoginEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/QuietLoginEvent.java
deleted file mode 100644
index 74038f4..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/QuietLoginEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised when the user performs a quiet login
- */
-public class QuietLoginEvent
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/UserAuthenticatedEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/UserAuthenticatedEvent.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/UserAuthenticatedEvent.java
deleted file mode 100644
index 4c7bb61..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/events/UserAuthenticatedEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.api.events;
-
-/**
- * This event is raised when a user is authenticated
- */
-public class UserAuthenticatedEvent
-{
- private Object user;
-
- public UserAuthenticatedEvent(Object user)
- {
- this.user = user;
- }
-
- public Object getUser()
- {
- return user;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/Authenticator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/Authenticator.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/Authenticator.java
deleted file mode 100644
index a7c5364..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/Authenticator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.deltaspike.security.spi;
-
-import org.apache.deltaspike.security.api.User;
-
-/**
- * An Authenticator implementation is responsible for managing the user authentication process.
- */
-public interface Authenticator
-{
- public enum AuthenticationStatus
- {
- SUCCESS,
- FAILURE,
- DEFERRED
- }
-
- void authenticate();
-
- void postAuthenticate();
-
- AuthenticationStatus getStatus();
-
- User getUser();
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/EditableAccessDecisionVoterContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/EditableAccessDecisionVoterContext.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/EditableAccessDecisionVoterContext.java
deleted file mode 100644
index e7d9563..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/EditableAccessDecisionVoterContext.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.spi;
-
-import org.apache.deltaspike.security.api.AccessDecisionState;
-import org.apache.deltaspike.security.api.AccessDecisionVoterContext;
-import org.apache.deltaspike.security.api.SecurityViolation;
-
-/**
- * Interface which allows to provide a custom {@link AccessDecisionVoterContext} implementation
- */
-public interface EditableAccessDecisionVoterContext extends AccessDecisionVoterContext
-{
- /**
- * Allows to add custom meta-data. The default security strategy adds custom annotations of the intercepted method
- * as well as class-level annotations. (Currently inherited annotations aren't supported)
- * @param key key for the meta-data
- * @param metaData meta-data which should be added
- */
- void addMetaData(String key, Object metaData);
-
- /**
- * Updates the state of the context
- * @param accessDecisionVoterState current state
- */
- void setState(AccessDecisionState accessDecisionVoterState);
-
- /**
- * TODO review it (this method is new)
- * @param source e.g. the invocation-context
- */
- void setSource(Object source);
-
- /**
- * Adds a new {@link SecurityViolation} to the context
- * @param securityViolation security-violation which should be added
- */
- void addViolation(SecurityViolation securityViolation);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/SecurityStrategy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/SecurityStrategy.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/SecurityStrategy.java
deleted file mode 100644
index a64e7f1..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/SecurityStrategy.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.spi;
-
-import org.apache.deltaspike.core.spi.InterceptorStrategy;
-
-/**
- * Marker interface for a pluggable strategy for {@link org.apache.deltaspike.security.api.annotation.Secured}
- */
-public interface SecurityStrategy extends InterceptorStrategy
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/Authenticator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/Authenticator.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/Authenticator.java
new file mode 100644
index 0000000..2abcb88
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/Authenticator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.deltaspike.security.spi.authentication;
+
+import org.apache.deltaspike.security.api.User;
+
+/**
+ * An Authenticator implementation is responsible for managing the user authentication process.
+ */
+public interface Authenticator
+{
+ public enum AuthenticationStatus
+ {
+ SUCCESS,
+ FAILURE,
+ DEFERRED
+ }
+
+ void authenticate();
+
+ void postAuthenticate();
+
+ AuthenticationStatus getStatus();
+
+ User getUser();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/AuthenticatorSelector.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/AuthenticatorSelector.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/AuthenticatorSelector.java
new file mode 100644
index 0000000..669ec26
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/AuthenticatorSelector.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.spi.authentication;
+
+/**
+ * Selects which Authenticator implementation is used to manage the authentication process
+ */
+public interface AuthenticatorSelector
+{
+ Class<? extends Authenticator> getAuthenticatorClass();
+
+ void setAuthenticatorClass(Class<? extends Authenticator> authenticatorClass);
+
+ String getAuthenticatorName();
+
+ void setAuthenticatorName(String authenticatorName);
+
+ Authenticator getSelectedAuthenticator();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/BaseAuthenticator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/BaseAuthenticator.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/BaseAuthenticator.java
new file mode 100644
index 0000000..b22a19f
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/BaseAuthenticator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.spi.authentication;
+
+/**
+ * Abstract base class that Authenticator implementations can extend for convenience.
+ *
+ */
+public abstract class BaseAuthenticator implements Authenticator
+{
+ private AuthenticationStatus status;
+
+ public AuthenticationStatus getStatus()
+ {
+ return status;
+ }
+
+ protected void setStatus(AuthenticationStatus status)
+ {
+ this.status = status;
+ }
+
+ public void postAuthenticate()
+ {
+ // No-op, override if any post-authentication processing is required.
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/EditableAccessDecisionVoterContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/EditableAccessDecisionVoterContext.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/EditableAccessDecisionVoterContext.java
new file mode 100644
index 0000000..cc2a9c2
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/EditableAccessDecisionVoterContext.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.spi.authorization;
+
+import org.apache.deltaspike.security.api.authorization.AccessDecisionState;
+import org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;
+import org.apache.deltaspike.security.api.authorization.SecurityViolation;
+
+/**
+ * Interface which allows to provide a custom {@link AccessDecisionVoterContext} implementation
+ */
+public interface EditableAccessDecisionVoterContext extends AccessDecisionVoterContext
+{
+ /**
+ * Allows to add custom meta-data. The default security strategy adds custom annotations of the intercepted method
+ * as well as class-level annotations. (Currently inherited annotations aren't supported)
+ * @param key key for the meta-data
+ * @param metaData meta-data which should be added
+ */
+ void addMetaData(String key, Object metaData);
+
+ /**
+ * Updates the state of the context
+ * @param accessDecisionVoterState current state
+ */
+ void setState(AccessDecisionState accessDecisionVoterState);
+
+ /**
+ * TODO review it (this method is new)
+ * @param source e.g. the invocation-context
+ */
+ void setSource(Object source);
+
+ /**
+ * Adds a new {@link SecurityViolation} to the context
+ * @param securityViolation security-violation which should be added
+ */
+ void addViolation(SecurityViolation securityViolation);
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityStrategy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityStrategy.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityStrategy.java
new file mode 100644
index 0000000..9ec9143
--- /dev/null
+++ b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityStrategy.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.security.spi.authorization;
+
+import org.apache.deltaspike.core.spi.InterceptorStrategy;
+
+/**
+ * Marker interface for a pluggable strategy for
+ * {@link org.apache.deltaspike.security.api.authorization.annotation.Secured}
+ */
+public interface SecurityStrategy extends InterceptorStrategy
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/AuthenticatorSelectorImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/AuthenticatorSelectorImpl.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/AuthenticatorSelectorImpl.java
deleted file mode 100644
index 215ee53..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/AuthenticatorSelectorImpl.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.impl;
-
-import java.util.List;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-
-import org.apache.deltaspike.core.api.literal.NamedLiteral;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.util.StringUtils;
-import org.apache.deltaspike.security.api.AuthenticatorSelector;
-import org.apache.deltaspike.security.impl.jaas.JaasAuthenticator;
-import org.apache.deltaspike.security.impl.management.IdmAuthenticator;
-import org.apache.deltaspike.security.spi.Authenticator;
-
-/**
- * Default implementation of AuthenticatorSelector
- */
-public class AuthenticatorSelectorImpl implements AuthenticatorSelector
-{
- private String authenticatorName;
-
- private Class<? extends Authenticator> authenticatorClass;
-
- @Inject @Any
- private Instance<Authenticator> authenticators;
-
- /**
- * Returns an Authenticator instance to be used for authentication. The default
- * implementation obeys the following business logic:
- * <p/>
- * 1. If the user has specified an authenticatorClass property, use it to
- * locate the Authenticator with that exact type
- * 2. If the user has specified an authenticatorName property, use it to
- * locate and return the Authenticator with that name
- * 3. If the authenticatorClass and authenticatorName haven't been specified,
- * and the user has provided their own custom Authenticator, return that one
- * 4. If the user hasn't provided a custom Authenticator, return IdmAuthenticator
- * and attempt to use the Identity Management API to authenticate
- *
- * @return
- */
- public Authenticator getSelectedAuthenticator()
- {
- if (authenticatorClass != null)
- {
- return authenticators.select(authenticatorClass).get();
- }
-
- if (!StringUtils.isEmpty(authenticatorName))
- {
- Instance<Authenticator> selected = authenticators.select(new NamedLiteral(authenticatorName));
- if (selected.isAmbiguous())
- {
- //log.error("Multiple Authenticators found with configured name [" + authenticatorName + "]");
- return null;
- }
-
- if (selected.isUnsatisfied())
- {
- //log.error("No authenticator with name [" + authenticatorName + "] was found");
- return null;
- }
-
- return selected.get();
- }
-
- Authenticator selectedAuth = null;
-
- List<Authenticator> references = BeanProvider.getContextualReferences(Authenticator.class, true);
-
- for (Authenticator auth : references)
- {
- // If the user has provided their own custom authenticator then use it -
- // a custom authenticator is one that isn't one of the known authenticators;
- // JaasAuthenticator, IdmAuthenticator, or any external authenticator, etc
- if (!JaasAuthenticator.class.isAssignableFrom(auth.getClass()) &&
- !IdmAuthenticator.class.isAssignableFrom(auth.getClass()) &&
- !isExternalAuthenticator(auth.getClass()))
- {
- selectedAuth = auth;
- break;
- }
-
- if (IdmAuthenticator.class.isAssignableFrom(auth.getClass()))
- {
- selectedAuth = auth;
- }
- }
-
- return selectedAuth;
- }
-
-
- private boolean isExternalAuthenticator(Class<? extends Authenticator> authClass)
- {
- Class<?> cls = authClass;
-
- while (cls != Object.class)
- {
- if (cls.getName().startsWith("org.jboss.seam.security.external."))
- {
- return true;
- }
- cls = cls.getSuperclass();
- }
-
- return false;
- }
-
- public Class<? extends Authenticator> getAuthenticatorClass()
- {
- return authenticatorClass;
- }
-
- public void setAuthenticatorClass(Class<? extends Authenticator> authenticatorClass)
- {
- this.authenticatorClass = authenticatorClass;
- }
-
- public String getAuthenticatorName()
- {
- return authenticatorName;
- }
-
- public void setAuthenticatorName(String authenticatorName)
- {
- this.authenticatorName = authenticatorName;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/Authorizer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/Authorizer.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/Authorizer.java
deleted file mode 100644
index cb8ff72..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/Authorizer.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.impl;
-
-import org.apache.deltaspike.core.api.metadata.builder.InjectableMethod;
-import org.apache.deltaspike.core.api.metadata.builder.ParameterValueRedefiner;
-import org.apache.deltaspike.security.api.AuthorizationException;
-import org.apache.deltaspike.security.api.SecurityDefinitionException;
-import org.apache.deltaspike.security.api.annotation.SecurityBindingType;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Stereotype;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.Nonbinding;
-import javax.interceptor.InvocationContext;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-class Authorizer
-{
- private BeanManager beanManager;
-
- private Annotation binding;
- private Map<Method, Object> memberValues = new HashMap<Method, Object>();
-
- private AnnotatedMethod<?> implementationMethod;
- private Bean<?> targetBean;
-
- private InjectableMethod<?> injectableMethod;
-
- Authorizer(Annotation binding, AnnotatedMethod<?> implementationMethod, BeanManager beanManager)
- {
- this.binding = binding;
- this.implementationMethod = implementationMethod;
- this.beanManager = beanManager;
-
- try
- {
- for (Method method : binding.annotationType().getDeclaredMethods())
- {
- if (method.isAnnotationPresent(Nonbinding.class))
- {
- continue;
- }
- memberValues.put(method, method.invoke(binding));
- }
- }
- catch (InvocationTargetException ex)
- {
- throw new SecurityDefinitionException("Error reading security binding members", ex);
- }
- catch (IllegalAccessException ex)
- {
- throw new SecurityDefinitionException("Error reading security binding members", ex);
- }
- }
-
- public void authorize(final InvocationContext ic)
- {
- if (targetBean == null)
- {
- lazyInitTargetBean();
- }
-
- final CreationalContext<?> creationalContext = beanManager.createCreationalContext(targetBean);
-
- Object reference = beanManager.getReference(targetBean,
- implementationMethod.getJavaMember().getDeclaringClass(), creationalContext);
-
- Object result = injectableMethod.invoke(reference, creationalContext, new ParameterValueRedefiner() {
-
- @Override
- public Object redefineParameterValue(ParameterValue value)
- {
- if (value.getInjectionPoint().getAnnotated().getBaseType().equals(InvocationContext.class))
- {
- return ic;
- }
- else
- {
- return value.getDefaultValue(creationalContext);
- }
- }
- });
-
- if (result.equals(Boolean.FALSE))
- {
- throw new AuthorizationException("Authorization check failed");
- }
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private synchronized void lazyInitTargetBean()
- {
- if (targetBean == null)
- {
- Method method = implementationMethod.getJavaMember();
-
- Set<Bean<?>> beans = beanManager.getBeans(method.getDeclaringClass());
- if (beans.size() == 1)
- {
- targetBean = beans.iterator().next();
- }
- else if (beans.isEmpty())
- {
- throw new IllegalStateException("Exception looking up authorizer method bean - " +
- "no beans found for method [" + method.getDeclaringClass() + "." +
- method.getName() + "]");
- }
- else if (beans.size() > 1)
- {
- throw new IllegalStateException("Exception looking up authorizer method bean - " +
- "multiple beans found for method [" + method.getDeclaringClass().getName() + "." +
- method.getName() + "]");
- }
-
- injectableMethod = new InjectableMethod(implementationMethod, targetBean, beanManager);
- }
- }
-
- public boolean matchesBinding(Annotation annotation)
- {
- if (!annotation.annotationType().isAnnotationPresent(SecurityBindingType.class) &&
- annotation.annotationType().isAnnotationPresent(Stereotype.class))
- {
- annotation = SecurityUtils.resolveSecurityBindingType(annotation);
- }
-
- if (!annotation.annotationType().equals(binding.annotationType()))
- {
- return false;
- }
-
- for (Method method : annotation.annotationType().getDeclaredMethods())
- {
- if (method.isAnnotationPresent(Nonbinding.class))
- {
- continue;
- }
-
- if (!memberValues.containsKey(method))
- {
- return false;
- }
-
- try
- {
- Object value = method.invoke(annotation);
- if (!memberValues.get(method).equals(value))
- {
- return false;
- }
- }
- catch (InvocationTargetException ex)
- {
- throw new SecurityDefinitionException("Error reading security binding members", ex);
- }
- catch (IllegalAccessException ex)
- {
- throw new SecurityDefinitionException("Error reading security binding members", ex);
- }
- }
-
- return true;
- }
-
- public Method getImplementationMethod()
- {
- return implementationMethod.getJavaMember();
- }
-
- @Override
- public boolean equals(Object value)
- {
- return false;
- }
-
- //not used
- @Override
- public int hashCode()
- {
- return 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/CredentialsImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/CredentialsImpl.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/CredentialsImpl.java
deleted file mode 100644
index a7bbaf9..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/CredentialsImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.impl;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.deltaspike.security.api.Credential;
-import org.apache.deltaspike.security.api.Credentials;
-import org.apache.deltaspike.security.api.events.CredentialsInitializedEvent;
-import org.apache.deltaspike.security.api.events.CredentialsUpdatedEvent;
-import org.apache.deltaspike.security.api.events.LoginFailedEvent;
-
-/**
- * The default Credentials implementation. This implementation allows for a
- * username and plain text password to be set, and uses the PasswordCredential
- * implementation of the Credential interface for authentication.
- */
-@Named("credentials")
-@SessionScoped
-public class CredentialsImpl implements Credentials, Serializable
-{
- private static final long serialVersionUID = -2271248957776488426L;
-
- @Inject
- BeanManager manager;
-
- private String username;
- private Credential credential;
-
- private boolean invalid;
-
- private boolean initialized;
-
- public CredentialsImpl()
- {
- }
-
- public boolean isInitialized()
- {
- return initialized;
- }
-
- public void setInitialized(boolean initialized)
- {
- this.initialized = initialized;
- }
-
- public String getUsername()
- {
- if (!isInitialized())
- {
- setInitialized(true);
- manager.fireEvent(new CredentialsInitializedEvent(this));
- }
-
- return username;
- }
-
- public Credential getCredential()
- {
- return credential;
- }
-
- public void setCredential(Credential credential)
- {
- this.credential = credential;
- }
-
- public void setUsername(String username)
- {
- if (this.username != username && (this.username == null || !this.username.equals(username)))
- {
- this.username = username;
- invalid = false;
- manager.fireEvent(new CredentialsUpdatedEvent());
- }
- }
-
- public String getPassword()
- {
- return credential != null && credential instanceof PasswordCredential ?
- ((PasswordCredential) credential).getValue() : null;
- }
-
- public void setPassword(String password)
- {
- if (this.credential == null)
- {
- this.credential = new PasswordCredential(password);
- }
- else if (this.credential != null && this.credential instanceof PasswordCredential &&
- ((PasswordCredential) this.credential).getValue() != password &&
- ((PasswordCredential) this.credential).getValue() == null ||
- !((PasswordCredential) this.credential).getValue().equals(password))
- {
- this.credential = new PasswordCredential(password);
- invalid = false;
- manager.fireEvent(new CredentialsUpdatedEvent());
- }
- }
-
- public boolean isSet()
- {
- return getUsername() != null && this.credential != null &&
- ((PasswordCredential) this.credential).getValue() != null;
- }
-
- public boolean isInvalid()
- {
- return invalid;
- }
-
- public void invalidate()
- {
- invalid = true;
- }
-
- public void clear()
- {
- username = null;
- this.credential = null;
- initialized = false;
- }
-
- public void loginFailed(@Observes LoginFailedEvent event)
- {
- invalidate();
- }
-
- @Override
- public String toString()
- {
- return "Credentials[" + username + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultAccessDecisionVoterContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultAccessDecisionVoterContext.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultAccessDecisionVoterContext.java
deleted file mode 100644
index 058a8f0..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultAccessDecisionVoterContext.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.impl;
-
-import org.apache.deltaspike.security.api.AccessDecisionState;
-import org.apache.deltaspike.security.api.SecurityViolation;
-import org.apache.deltaspike.security.spi.EditableAccessDecisionVoterContext;
-
-import javax.enterprise.context.RequestScoped;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * {@inheritDoc}
- */
-@RequestScoped //TODO we might need a different scope for it
-public class DefaultAccessDecisionVoterContext implements EditableAccessDecisionVoterContext
-{
- private AccessDecisionState state = AccessDecisionState.INITIAL;
-
- private List<SecurityViolation> securityViolations;
-
- private Map<String, Object> metaData = new HashMap<String, Object>();
-
- private Object source;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public AccessDecisionState getState()
- {
- return this.state;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<SecurityViolation> getViolations()
- {
- if (this.securityViolations == null)
- {
- return Collections.emptyList();
- }
- return Collections.unmodifiableList(this.securityViolations);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <T> T getSource()
- {
- return (T)this.source;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setSource(Object source)
- {
- this.source = source;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<String, Object> getMetaData()
- {
- return Collections.unmodifiableMap(this.metaData);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <T> T getMetaDataFor(String key, Class<T> targetType)
- {
- return (T) this.metaData.get(key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addMetaData(String key, Object metaData)
- {
- //TODO specify nested security calls
- this.metaData.put(key, metaData);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setState(AccessDecisionState accessDecisionVoterState)
- {
- if (AccessDecisionState.VOTE_IN_PROGRESS.equals(accessDecisionVoterState))
- {
- this.securityViolations = new ArrayList<SecurityViolation>(); //lazy init
- }
-
- this.state = accessDecisionVoterState;
-
- if (AccessDecisionState.INITIAL.equals(accessDecisionVoterState) ||
- AccessDecisionState.VOTE_IN_PROGRESS.equals(accessDecisionVoterState))
- {
- return;
- }
-
- //meta-data is only needed until the end of a voting process
- this.metaData.clear();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addViolation(SecurityViolation securityViolation)
- {
- if (this.securityViolations == null)
- {
- throw new IllegalStateException(
- AccessDecisionState.VOTE_IN_PROGRESS.name() + " is required for adding security-violations");
- }
- this.securityViolations.add(securityViolation);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/1a2c7ffd/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultSecurityStrategy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultSecurityStrategy.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultSecurityStrategy.java
deleted file mode 100644
index 6ac0f53..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultSecurityStrategy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.security.impl;
-
-import org.apache.deltaspike.security.spi.SecurityStrategy;
-
-import javax.enterprise.context.Dependent;
-import javax.interceptor.InvocationContext;
-import java.lang.reflect.Method;
-
-/**
- * {@inheritDoc}
- */
-@Dependent
-public class DefaultSecurityStrategy implements SecurityStrategy
-{
- private static final long serialVersionUID = 7992336651801599079L;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object execute(InvocationContext invocationContext) throws Exception
- {
- Method method = invocationContext.getMethod();
-
- SecurityMetaDataStorage metaDataStorage = SecurityExtension.getMetaDataStorage();
-
- for (Authorizer authorizer : metaDataStorage.getAuthorizers(invocationContext.getTarget().getClass(), method))
- {
- authorizer.authorize(invocationContext);
- }
-
- return invocationContext.proceed();
- }
-}