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/07/29 23:39:28 UTC
[2/5] DELTASPIKE-249 remove packages authentication, credential,
idm and permission
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/GroupQuery.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/GroupQuery.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/GroupQuery.java
deleted file mode 100644
index e39fdc0..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/GroupQuery.java
+++ /dev/null
@@ -1,79 +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.idm;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * GroupQuery. All applied conditions will be resolved with logical AND.
- */
-public interface GroupQuery
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- // Operations
-
- GroupQuery reset();
-
- GroupQuery immutable();
-
- List<Group> executeQuery(GroupQuery query);
-
-
- // Conditions
-
- GroupQuery setName(String name);
-
- String getName();
-
- GroupQuery setId(String id);
-
- String getId();
-
- GroupQuery setParentGroup(Group group);
-
- GroupQuery setParentGroup(String groupId);
-
- Group getParentGroup();
-
- GroupQuery setRole(Role role);
-
- GroupQuery setRole(String role);
-
- Role getRole();
-
- GroupQuery setRelatedUser(User user);
-
- GroupQuery setRelatedUser(String user);
-
- User getRelatedUser();
-
- GroupQuery addAttributeFilter(String name, String[] values);
-
- Map<String, String[]> getAttributeFilters();
-
- GroupQuery sort(boolean ascending);
-
- void setRange(Range range);
-
- Range getRange();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityManager.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityManager.java
deleted file mode 100644
index 2bab5d1..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityManager.java
+++ /dev/null
@@ -1,116 +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.idm;
-
-import java.util.Collection;
-import java.util.Date;
-
-/**
- * IdentityManager
- */
-public interface IdentityManager
-{
- //TODO: Javadocs
-
- //TODO: Exceptions
-
- //TODO: control hooks & events
-
- //TODO: linking identities
-
-
- // User
-
- User createUser(String name);
-
- void removeUser(User user);
-
- void removeUser(String name);
-
- User getUser(String name);
-
- Collection<User> getAllUsers();
-
-
- // Group
-
- Group createGroup(String id);
-
- Group createGroup(String id, Group parent);
-
- Group createGroup(String id, String parent);
-
- void removeGroup(Group group);
-
- void removeGroup(String groupId);
-
- Group getGroup(String groupId);
-
- Group getGroup(String groupId, Group parent);
-
- Collection<Group> getAllGroups();
-
- void addToGroup(IdentityType identityType, Group group);
-
- void removeFromGroup(IdentityType identityType, Group group);
-
- Collection<IdentityType> getGroupMembers(Group group);
-
- // Roles
-
- Role createRole(String name);
-
- void removeRole(Role role);
-
- void removeRole(String name);
-
- Role getRole(String name);
-
- Collection<Role> getAllRoles();
-
- Collection<Role> getRoles(IdentityType identityType, Group group);
-
- boolean hasRole(Role role, IdentityType identityType, Group group);
-
- void grantRole(Role role, IdentityType identityType, Group group);
-
- void revokeRole(Role role, IdentityType identityType, Group group);
-
- // Queries
-
- UserQuery createUserQuery();
-
- GroupQuery createGroupQuery();
-
- RoleQuery createRoleQuery();
-
- MembershipQuery createMembershipQuery();
-
- // Password Management
-
- boolean validatePassword(String password);
-
- void updatePassword(String password);
-
- // User / Role / Group enablement / expiry
-
- void setEnabled(IdentityType identityType, boolean enabled);
-
- void setExpirationDate(IdentityType identityType, Date expirationDate);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityType.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityType.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityType.java
deleted file mode 100644
index a9f27eb..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/IdentityType.java
+++ /dev/null
@@ -1,84 +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.idm;
-
-import java.util.Date;
-import java.util.Map;
-
-/**
- * IdentityObject
- *
- */
-public interface IdentityType
-{
-
- String getKey();
-
- boolean isEnabled();
-
- Date getExpirationDate();
-
- Date getCreationDate();
-
- // Attributes
-
- /**
- * Set attribute with given name and value. Operation will overwrite any previous value.
- * Null value will remove attribute.
- *
- * @param name of attribute
- * @param value to be set
- */
- void setAttribute(String name, String value);
-
- /**
- * Set attribute with given name and values. Operation will overwrite any previous values.
- * Null value or empty array will remove attribute.
- *
- * @param name of attribute
- * @param values to be set
- */
- void setAttribute(String name, String[] values);
-
- /**
- * Remove attribute with given name
- *
- * @param name of attribute
- */
- void removeAttribute(String name);
-
- /**
- * @param name of attribute
- * @return attribute values or null if attribute with given name doesn't exist. If given attribute has many values
- * method will return first one
- */
- String getAttribute(String name);
-
- /**
- * @param name of attribute
- * @return attribute values or null if attribute with given name doesn't exist
- */
- String[] getAttributeValues(String name);
-
- /**
- * @return map of attribute names and their values
- */
- Map<String, String[]> getAttributes();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Membership.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Membership.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Membership.java
deleted file mode 100644
index f3bfb77..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Membership.java
+++ /dev/null
@@ -1,34 +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.idm;
-
-/**
- * Membership links User, Group and Role.
- */
-public interface Membership
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- User getUser();
-
- Group getGroup();
-
- Role getRole();
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/MembershipQuery.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/MembershipQuery.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/MembershipQuery.java
deleted file mode 100644
index 7516d2a..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/MembershipQuery.java
+++ /dev/null
@@ -1,64 +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.idm;
-
-import java.util.List;
-
-/**
- * MembershipQuery. All applied conditions will be resolved with logical AND.
- */
-public interface MembershipQuery
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- // Operations
-
- MembershipQuery reset();
-
- MembershipQuery immutable();
-
- List<Membership> executeQuery(MembershipQuery query);
-
-
- // Conditions
-
- MembershipQuery setUser(User user);
-
- MembershipQuery setUser(String user);
-
- User getUser();
-
- MembershipQuery setGroup(Group group);
-
- MembershipQuery setGroup(String groupId);
-
- Group getGroup();
-
- MembershipQuery setRole(Role role);
-
- MembershipQuery setRole(String role);
-
- Role getRole();
-
- void setRange(Range range);
-
- Range getRange();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Range.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Range.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Range.java
deleted file mode 100644
index 1a9eacf..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Range.java
+++ /dev/null
@@ -1,70 +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.idm;
-
-/**
- * Represent range in paginated query
- */
-public class Range
-{
- //TODO: Just a quick impl
-
- private int offset;
-
- private int limit = -1;
-
- private Range()
- {
- }
-
- private Range(int offset, int limit)
- {
- this.offset = offset;
- this.limit = limit;
- }
-
- int getPage()
- {
- //TODO: Calculate based on limit/offset.
- //TODO: Should it start from 0 or 1? Rather 1....
- return 1;
- }
-
- public int getOffset()
- {
- return offset;
- }
-
- public int getLimit()
- {
- return limit;
- }
-
- public Range of(int offset, int limit)
- {
- return new Range(offset, limit);
- }
-
- public Range next()
- {
- offset += limit;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Role.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Role.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Role.java
deleted file mode 100644
index 3bebbad..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/Role.java
+++ /dev/null
@@ -1,30 +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.idm;
-
-
-/**
- * Role representation
- */
-public interface Role extends IdentityType
-{
- // Self
-
- String getName();
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/RoleQuery.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/RoleQuery.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/RoleQuery.java
deleted file mode 100644
index 218fc8c..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/RoleQuery.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.idm;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * RoleQuery. All applied conditions will be resolved with logical AND.
- */
-public interface RoleQuery
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- // Operations
-
- RoleQuery reset();
-
- RoleQuery getImmutable();
-
- List<Role> executeQuery(RoleQuery query);
-
- // Conditions
-
- RoleQuery setName(String name);
-
- RoleQuery setOwner(IdentityType owner);
-
- RoleQuery setGroup(Group group);
-
- RoleQuery setGroup(String groupId);
-
- RoleQuery setAttributeFilter(String name, String[] values);
-
- Map<String, String[]> getAttributeFilters();
-
- RoleQuery sort(boolean ascending);
-
- void setRange(Range range);
-
- Range getRange();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleGroup.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleGroup.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleGroup.java
deleted file mode 100644
index 7b01ad4..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleGroup.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.api.idm;
-
-/**
- * Simple implementation of the Group interface
- *
- */
-public class SimpleGroup extends AbstractIdentityType implements Group
-{
- private String id;
- private String name;
- private Group parentGroup;
-
- public SimpleGroup(String id, String name, Group parentGroup)
- {
- this.id = id;
- this.name = name;
- this.parentGroup = parentGroup;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Group getParentGroup()
- {
- return parentGroup;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleRole.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleRole.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleRole.java
deleted file mode 100644
index 60d6c3a..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleRole.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.idm;
-
-/**
- * Simple implementation of the Role interface
- */
-public class SimpleRole extends AbstractIdentityType implements Role
-{
- private String name;
-
- public SimpleRole(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleUser.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleUser.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleUser.java
deleted file mode 100644
index 2f579de..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/SimpleUser.java
+++ /dev/null
@@ -1,83 +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.idm;
-
-/**
- * A simple User implementation
- */
-public class SimpleUser extends AbstractIdentityType implements User
-{
- private String id;
- private String firstName;
- private String lastName;
- private String email;
-
- public SimpleUser(String id)
- {
- this.id = id;
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- @Override
- public String getFirstName()
- {
- return firstName;
- }
-
- @Override
- public void setFirstName(String firstName)
- {
- this.firstName = firstName;
- }
-
- @Override
- public String getLastName()
- {
- return lastName;
- }
-
- @Override
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
-
- @Override
- public String getFullName()
- {
- return String.format("%s %s", firstName, lastName);
- }
-
- @Override
- public String getEmail()
- {
- return email;
- }
-
- @Override
- public void setEmail(String email)
- {
- this.email = email;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/User.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/User.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/User.java
deleted file mode 100644
index b059cd5..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/User.java
+++ /dev/null
@@ -1,59 +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.idm;
-
-/**
- * User representation
- */
-public interface User extends IdentityType
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- //TODO: minimal set of "hard-coded" attributes that make sense:
- //TODO: Personal - First/Last/Full Name, Phone, Email, Organization, Created Date, Birthdate; Too much??
-
- //TODO: separate UserProfile?
-
- //TODO: for some of those builtin attributes like email proper validation (dedicated exception?) is needed
-
- //TODO: authentication - password/token validation
-
- //TODO: non human identity - another interface?
-
-
- // Built in attributes
-
- String getId();
-
- String getFirstName();
-
- void setFirstName(String firstName);
-
- String getLastName();
-
- void setLastName(String lastName);
-
- //TODO: this one could be configurable with some regex
- String getFullName();
-
- String getEmail();
-
- void setEmail(String email);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/UserQuery.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/UserQuery.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/UserQuery.java
deleted file mode 100644
index f597fec..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/idm/UserQuery.java
+++ /dev/null
@@ -1,97 +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.idm;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * UserQuery. All applied conditions will be resolved with logical AND.
- */
-public interface UserQuery
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- //TODO: add searchBy stuff that makes sense: email, first/last/full name, organization?
-
- //TODO: make clear comment in javadoc about usage of wildcards -
- //TODO: should support at least usage of '*' for all built in attributes mentioned above.
-
-
-
- // Operations
-
- UserQuery reset();
-
- UserQuery getImmutable();
-
- List<User> executeQuery(UserQuery query);
-
-
- // Conditions
-
- UserQuery setName(String name);
-
- String getName();
-
- UserQuery setRelatedGroup(Group group);
-
- UserQuery setRelatedGroup(String groupId);
-
- Group getRelatedGroup();
-
- UserQuery setRole(Role role);
-
- UserQuery setRole(String name);
-
- Role getRole();
-
- UserQuery setAttributeFilter(String name, String[] values);
-
- Map<String, String[]> getAttributeFilters();
-
- // Built in attributes
-
- UserQuery setFirstName(String firstName);
-
- String getFirstName();
-
- UserQuery setLastName(String lastName);
-
- String getLastName();
-
- UserQuery setEmail(String email);
-
- String getEmail();
-
- UserQuery setEnabled(boolean enabled);
-
- boolean getEnabled();
-
-
- // Pagination
-
- UserQuery sort(boolean ascending);
-
- void setRange(Range range);
-
- Range getRange();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/Permission.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/Permission.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/Permission.java
deleted file mode 100644
index 4221eed..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/Permission.java
+++ /dev/null
@@ -1,54 +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.permission;
-
-import org.apache.deltaspike.security.api.idm.IdentityType;
-
-/**
- * Represents a specific permission grant for a domain object
- *
- */
-public class Permission
-{
- private Object resource;
- private IdentityType recipient;
- private String permission;
-
- public Permission(Object resource, IdentityType recipient, String permission)
- {
- this.resource = resource;
- this.recipient = recipient;
- this.permission = permission;
- }
-
- public Object getResource()
- {
- return resource;
- }
-
- public IdentityType getRecipient()
- {
- return recipient;
- }
-
- public String getPermission()
- {
- return permission;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionManager.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionManager.java
deleted file mode 100644
index 5a11d65..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionManager.java
+++ /dev/null
@@ -1,59 +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.permission;
-
-import java.util.Collection;
-
-
-/**
- * Manages user, role and group permissions.
- *
- */
-public interface PermissionManager
-{
- /**
- *
- * @return A new PermissionQuery
- */
- PermissionQuery createPermissionQuery();
-
- /**
- *
- * @param permission
- */
- void grantPermission(Permission permission);
-
- /**
- *
- * @param permission
- */
- void grantPermissions(Collection<Permission> permission);
-
- /**
- *
- * @param permission
- */
- void revokePermission(Permission permission);
-
- /**
- *
- * @param permissions
- */
- void revokePermissions(Collection<Permission> permissions);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionQuery.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionQuery.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionQuery.java
deleted file mode 100644
index ba0d3f1..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/PermissionQuery.java
+++ /dev/null
@@ -1,96 +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.permission;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.deltaspike.security.api.idm.IdentityType;
-import org.apache.deltaspike.security.api.idm.Range;
-import org.apache.deltaspike.security.spi.permission.PermissionStore;
-
-/**
- * API for querying object permissions
- *
- */
-public class PermissionQuery
-{
- private Object resource;
- private Set<Object> resources;
- private Range range;
- private IdentityType recipient;
-
- private PermissionStore permissionStore;
-
- public PermissionQuery(PermissionStore permissionStore)
- {
- this.permissionStore = permissionStore;
- }
-
- public Object getResource()
- {
- return resource;
- }
-
- public PermissionQuery setResource(Object resource)
- {
- this.resource = resource;
- this.resources = null;
- return this;
- }
-
- public Set<Object> getResources()
- {
- return resources;
- }
-
- public PermissionQuery setResources(Set<Object> resources)
- {
- this.resources = resources;
- this.resource = null;
- return this;
- }
-
- public Range getRange()
- {
- return range;
- }
-
- public PermissionQuery setRange(Range range)
- {
- this.range = range;
- return this;
- }
-
- public IdentityType getRecipient()
- {
- return recipient;
- }
-
- public PermissionQuery setRecipient(IdentityType recipient)
- {
- this.recipient = recipient;
- return this;
- }
-
- public List<Permission> getResultList()
- {
- return permissionStore.getPermissions(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLIdentifier.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLIdentifier.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLIdentifier.java
deleted file mode 100644
index 6f5dc6f..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLIdentifier.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Marks the field of an @ACLStore annotated entity bean as containing the identifier value for the
- * resource.
- *
- */
-@Target({ METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-public @interface ACLIdentifier
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLPermission.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLPermission.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLPermission.java
deleted file mode 100644
index 1812187..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLPermission.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation. Denotes the field of an @ACLStore annotated entity bean as containing the
- * granted ACL permissions.
- *
- */
-@Target({ METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-public @interface ACLPermission
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLRecipient.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLRecipient.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLRecipient.java
deleted file mode 100644
index 47e56d0..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLRecipient.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Marks the field of an @ACLStore annotated entity bean as containing the recipient of the ACL permissions
- *
- */
-@Target({ METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-public @interface ACLRecipient
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLResourceClass.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLResourceClass.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLResourceClass.java
deleted file mode 100644
index 2e13a5d..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLResourceClass.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation. Denotes the field of an @ACLStore annotated entity bean as containing the
- * fully qualified class name of the resource being secured
- *
- */
-@Target({ METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-public @interface ACLResourceClass
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLStore.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLStore.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLStore.java
deleted file mode 100644
index 37f790e..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/ACLStore.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes an entity bean (i.e. a class annotated with @Entity) as being a storage container
- * for object permissions. If the value member is set, then the annotated entity will be used
- * to lookup object permissions for objects of that class only, otherwise if it is not set the
- * entity will be used to store general object permissions (only one entity may be used for
- * general permissions, if more than one entity is defined then a deployment exception will be
- * thrown).
- */
-@Target({ TYPE })
-@Retention(RUNTIME)
-@Documented
-public @interface ACLStore
-{
- Class<?> value() default GENERAL.class;
-
- // Dummy class to enable the entity bean for general storage of ACL permissions
- static final class GENERAL
- { }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/CheckPermissions.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/CheckPermissions.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/CheckPermissions.java
deleted file mode 100644
index b2d9542..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/CheckPermissions.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.permission.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import org.apache.deltaspike.security.api.authorization.annotation.SecurityBindingType;
-
-@Target({ METHOD })
-@Retention(RUNTIME)
-@Documented
-
-//cdi annotations
-@SecurityBindingType
-public @interface CheckPermissions
-{
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/RequiresPermission.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/RequiresPermission.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/RequiresPermission.java
deleted file mode 100644
index 7428b9b..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/permission/annotations/RequiresPermission.java
+++ /dev/null
@@ -1,34 +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.permission.annotations;
-
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Target({ PARAMETER })
-@Retention(RUNTIME)
-@Documented
-public @interface RequiresPermission
-{
- String value() default "";
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/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
deleted file mode 100644
index e285cbd..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/Authenticator.java
+++ /dev/null
@@ -1,44 +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.authentication;
-
-import org.apache.deltaspike.security.api.idm.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/79b06715/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
deleted file mode 100644
index 669ec26..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/AuthenticatorSelector.java
+++ /dev/null
@@ -1,35 +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.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/79b06715/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
deleted file mode 100644
index 05cf309..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authentication/BaseAuthenticator.java
+++ /dev/null
@@ -1,56 +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.authentication;
-
-import org.apache.deltaspike.security.api.idm.User;
-
-/**
- * Abstract base class that Authenticator implementations can extend for convenience.
- *
- */
-public abstract class BaseAuthenticator implements Authenticator
-{
- private AuthenticationStatus status = AuthenticationStatus.FAILURE;
- private User user;
-
- public AuthenticationStatus getStatus()
- {
- return status;
- }
-
- protected void setStatus(AuthenticationStatus status)
- {
- this.status = status;
- }
-
- protected void setUser(User user)
- {
- this.user = user;
- }
-
- public User getUser()
- {
- return user;
- }
-
- public void postAuthenticate()
- {
- // No-op, override if any post-authentication processing is required.
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/idm/IdentityStore.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/idm/IdentityStore.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/idm/IdentityStore.java
deleted file mode 100644
index ff007cf..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/idm/IdentityStore.java
+++ /dev/null
@@ -1,201 +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.idm;
-
-import org.apache.deltaspike.security.api.idm.Group;
-import org.apache.deltaspike.security.api.idm.GroupQuery;
-import org.apache.deltaspike.security.api.idm.Membership;
-import org.apache.deltaspike.security.api.idm.MembershipQuery;
-import org.apache.deltaspike.security.api.idm.Range;
-import org.apache.deltaspike.security.api.idm.Role;
-import org.apache.deltaspike.security.api.idm.RoleQuery;
-import org.apache.deltaspike.security.api.idm.User;
-import org.apache.deltaspike.security.api.idm.UserQuery;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * IdentityStore representation providing minimal SPI
- *
- */
-public interface IdentityStore
-{
- //TODO: Javadocs
- //TODO: Exceptions
-
- //TODO: control hooks, events
- //TODO: authentication, password strenght, salted password hashes
-
-
- // User
-
- User createUser(String name);
-
- void removeUser(User user);
-
- User getUser(String name);
-
-
- // Group
-
- Group createGroup(String name, Group parent);
-
- void removeGroup(Group group);
-
- Group getGroup(String name);
-
-
- // Role
-
- Role createRole(String name);
-
- void removeRole(Role role);
-
- Role getRole(String role);
-
-
- // Memberships
-
- Membership createMembership(Role role, User user, Group group);
-
- void removeMembership(Role role, User user, Group group);
-
- Membership getMembership(Role role, User user, Group group);
-
-
- // Queries
-
- List<User> executeQuery(UserQuery query, Range range);
-
- List<Group> executeQuery(GroupQuery query, Range range);
-
- List<Role> executeQuery(RoleQuery query, Range range);
-
- List<Membership> executeQuery(MembershipQuery query, Range range);
-
-
- // Attributes
-
-
- // User
-
- /**
- * Set attribute with given name and values. Operation will overwrite any previous values.
- * Null value or empty array will remove attribute.
- *
- * @param user
- * @param name of attribute
- * @param values to be set
- */
- void setAttribute(User user, String name, String[] values);
-
- /**
- * @param user
- * Remove attribute with given name
- *
- * @param name of attribute
- */
- void removeAttribute(User user, String name);
-
-
- /**
- * @param user
- * @param name of attribute
- * @return attribute values or null if attribute with given name doesn't exist
- */
- String[] getAttributeValues(User user, String name);
-
- /**
- * @param user
- * @return map of attribute names and their values
- */
- Map<String, String[]> getAttributes(User user);
-
-
- // Group
-
- /**
- * Set attribute with given name and values. Operation will overwrite any previous values.
- * Null value or empty array will remove attribute.
- *
- * @param group
- * @param name of attribute
- * @param values to be set
- */
- void setAttribute(Group group, String name, String[] values);
-
- /**
- * Remove attribute with given name
- *
- * @param group
- * @param name of attribute
- */
- void removeAttribute(Group group, String name);
-
-
- /**
- * @param group
- * @param name of attribute
- * @return attribute values or null if attribute with given name doesn't exist
- */
- String[] getAttributeValues(Group group, String name);
-
- /**
- * @param group
- * @return map of attribute names and their values
- */
- Map<String, String[]> getAttributes(Group group);
-
-
- // Role
-
- /**
- * Set attribute with given name and values. Operation will overwrite any previous values.
- * Null value or empty array will remove attribute.
- *
- * @param role
- * @param name of attribute
- * @param values to be set
- */
- void setAttribute(Role role, String name, String[] values);
-
- /**
- * Remove attribute with given name
- *
- * @param role
- * @param name of attribute
- */
- void removeAttribute(Role role, String name);
-
-
- /**
- * @param role
- * @param name of attribute
- * @return attribute values or null if attribute with given name doesn't exist
- */
- String[] getAttributeValues(Role role, String name);
-
- /**
- * @param role
- * @return map of attribute names and their values
- */
- Map<String, String[]> getAttributes(Role role);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionResolver.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionResolver.java
deleted file mode 100644
index 739f107..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionResolver.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.permission;
-
-import java.io.Serializable;
-
-/**
- * A PermissionResolver may be used to determine access restrictions for application resources. For every
- * permission check the application performs, the hasPermission() method of each known PermissionResolver
- * is invoked. For the permission check to succeed, at least one PermissionResolver must return a result of
- * PermissionStatus.ALLOW. If any PermissionResolver returns a result of PermissionStatus.DENY, the
- * permission check is unsuccessful and the user is not allowed to carry out the requested operation.
- * If a PermissionResolver does not explicitly allow or deny the permission, it should return a result of
- * PermissionStatus.NOT_APPLICABLE.
- *
- */
-public interface PermissionResolver
-{
- public enum PermissionStatus
- {
- ALLOW, DENY, NOT_APPLICABLE
- }
-
- PermissionStatus hasPermission(Object resource, String operation);
-
- PermissionStatus hasPermission(Class<?> resourceClass, Serializable identifier, String operation);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionStore.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionStore.java b/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionStore.java
deleted file mode 100644
index 5ab7456..0000000
--- a/deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/permission/PermissionStore.java
+++ /dev/null
@@ -1,48 +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.permission;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.deltaspike.security.api.permission.Permission;
-import org.apache.deltaspike.security.api.permission.PermissionQuery;
-
-/**
- *
- *
- */
-public interface PermissionStore
-{
- List<Permission> getPermissions(PermissionQuery query);
-
- boolean grantPermission(Permission permission);
-
- boolean grantPermissions(Collection<Permission> permissions);
-
- boolean revokePermission(Permission permission);
-
- boolean revokePermissions(Collection<Permission> permissions);
-
- List<String> listAvailableActions(Object target);
-
- void clearPermissions(Object target);
-
- boolean isEnabled();
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultIdentity.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultIdentity.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultIdentity.java
deleted file mode 100644
index dc725a5..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/DefaultIdentity.java
+++ /dev/null
@@ -1,245 +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.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.deltaspike.core.util.ExceptionUtils;
-import org.apache.deltaspike.security.api.Identity;
-import org.apache.deltaspike.security.api.authentication.AuthenticationException;
-import org.apache.deltaspike.security.api.authentication.UnexpectedCredentialException;
-import org.apache.deltaspike.security.api.authentication.event.AlreadyLoggedInEvent;
-import org.apache.deltaspike.security.api.authentication.event.LoggedInEvent;
-import org.apache.deltaspike.security.api.authentication.event.LoginFailedEvent;
-import org.apache.deltaspike.security.api.authentication.event.PostAuthenticateEvent;
-import org.apache.deltaspike.security.api.authentication.event.PostLoggedOutEvent;
-import org.apache.deltaspike.security.api.authentication.event.PreAuthenticateEvent;
-import org.apache.deltaspike.security.api.authentication.event.PreLoggedOutEvent;
-import org.apache.deltaspike.security.api.credential.LoginCredentials;
-import org.apache.deltaspike.security.api.idm.User;
-import org.apache.deltaspike.security.spi.authentication.Authenticator;
-import org.apache.deltaspike.security.spi.authentication.Authenticator.AuthenticationStatus;
-import org.apache.deltaspike.security.spi.authentication.AuthenticatorSelector;
-
-/**
- * Default Identity implementation
- */
-@SuppressWarnings("UnusedDeclaration")
-@SessionScoped
-@Named("identity")
-public class DefaultIdentity implements Identity
-{
- private static final long serialVersionUID = 3696702275353144429L;
-
- @Inject
- @SuppressWarnings("NonSerializableFieldInSerializableClass")
- private AuthenticatorSelector authenticatorSelector;
-
- @Inject
- @SuppressWarnings("NonSerializableFieldInSerializableClass")
- private BeanManager beanManager;
-
- @Inject
- @SuppressWarnings("NonSerializableFieldInSerializableClass")
- private LoginCredentials loginCredential;
-
- /**
- * Flag indicating whether we are currently authenticating
- */
- private boolean authenticating;
-
- private User user;
-
- public boolean isLoggedIn()
- {
- // If there is a user set, then the user is logged in.
- return this.user != null;
- }
-
- @Override
- public User getUser()
- {
- return this.user;
- }
-
- @Override
- public AuthenticationResult login()
- {
- try
- {
- if (isLoggedIn())
- {
- if (isAuthenticationRequestWithDifferentUserId())
- {
- throw new UnexpectedCredentialException("active user: " + this.user.getId() +
- " provided credentials: " + this.loginCredential.getUserId());
- }
-
- beanManager.fireEvent(new AlreadyLoggedInEvent());
- return AuthenticationResult.SUCCESS;
- }
-
- boolean success = authenticate();
-
- if (success)
- {
- beanManager.fireEvent(new LoggedInEvent()); //X TODO beanManager.fireEvent(new LoggedInEvent(user));
- return AuthenticationResult.SUCCESS;
- }
-
- beanManager.fireEvent(new LoginFailedEvent(null));
- return AuthenticationResult.FAILED;
- }
- catch (Exception e)
- {
- //X TODO discuss special handling of UnexpectedCredentialException
- beanManager.fireEvent(new LoginFailedEvent(e));
-
- if (e instanceof RuntimeException)
- {
- throw (RuntimeException)e;
- }
-
- ExceptionUtils.throwAsRuntimeException(e);
- //Attention: the following line is just for the compiler (and analysis tools) - it won't get executed
- throw new IllegalStateException(e);
- }
- }
-
- private boolean isAuthenticationRequestWithDifferentUserId()
- {
- return isLoggedIn() && this.loginCredential.getUserId() != null &&
- !this.loginCredential.getUserId().equals(this.user.getId());
- }
-
- protected boolean authenticate() throws AuthenticationException
- {
- if (authenticating)
- {
- authenticating = false; //X TODO discuss it
- throw new IllegalStateException("Authentication already in progress.");
- }
-
- try
- {
- authenticating = true;
-
- beanManager.fireEvent(new PreAuthenticateEvent());
-
- Authenticator activeAuthenticator = authenticatorSelector.getSelectedAuthenticator();
-
- if (activeAuthenticator == null)
- {
- throw new AuthenticationException("No Authenticator has been configured.");
- }
-
- activeAuthenticator.authenticate();
-
- if (activeAuthenticator.getStatus() == null)
- {
- throw new AuthenticationException("Authenticator must return a valid authentication status");
- }
-
- if (activeAuthenticator.getStatus() == AuthenticationStatus.SUCCESS)
- {
- postAuthenticate(activeAuthenticator);
- this.user = activeAuthenticator.getUser();
- return true;
- }
- }
- catch (Exception ex)
- {
- if (ex instanceof AuthenticationException)
- {
- throw (AuthenticationException) ex;
- }
- else
- {
- throw new AuthenticationException("Authentication failed.", ex);
- }
- }
- finally
- {
- authenticating = false;
- }
- return false;
- }
-
- protected void postAuthenticate(Authenticator activeAuthenticator)
- {
- activeAuthenticator.postAuthenticate();
-
- if (!activeAuthenticator.getStatus().equals(AuthenticationStatus.SUCCESS))
- {
- return;
- }
-
- beanManager.fireEvent(new PostAuthenticateEvent());
- }
-
- @Override
- public void logout()
- {
- logout(true);
- }
-
- protected void logout(boolean invalidateLoginCredential)
- {
- if (isLoggedIn())
- {
- beanManager.fireEvent(new PreLoggedOutEvent(this.user));
-
- PostLoggedOutEvent postLoggedOutEvent = new PostLoggedOutEvent(this.user);
-
- unAuthenticate(invalidateLoginCredential);
-
- beanManager.fireEvent(postLoggedOutEvent);
- }
- }
-
- /**
- * Resets all security state and loginCredential
- */
- private void unAuthenticate(boolean invalidateLoginCredential)
- {
- this.user = null;
-
- if (invalidateLoginCredential)
- {
- loginCredential.invalidate();
- }
- }
-
- public boolean hasPermission(Object resource, String operation)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean hasPermission(Class<?> resourceClass, Serializable identifier, String operation)
- {
- // TODO Auto-generated method stub
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/79b06715/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authentication/DefaultAuthenticatorSelector.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authentication/DefaultAuthenticatorSelector.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authentication/DefaultAuthenticatorSelector.java
deleted file mode 100644
index e2fd543..0000000
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authentication/DefaultAuthenticatorSelector.java
+++ /dev/null
@@ -1,132 +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.authentication;
-
-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.spi.authentication.Authenticator;
-import org.apache.deltaspike.security.spi.authentication.AuthenticatorSelector;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-import java.util.List;
-
-/**
- * Default implementation of AuthenticatorSelector
- */
-@RequestScoped
-public class DefaultAuthenticatorSelector 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
- */
- 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
- if (isExternalAuthenticator(auth.getClass()))
- {
- selectedAuth = auth;
- break;
- }
- }
-
- if (selectedAuth == null)
- {
- //X TODO discuss default
- }
-
- return selectedAuth;
- }
-
-
- private boolean isExternalAuthenticator(Class<? extends Authenticator> authClass)
- {
- //X TODO specify the behaviour
- return !authClass.getName().startsWith(getClass().getPackage().getName());
- }
-
- 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;
- }
-}