You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Gerhard Petracek (Reopened) (JIRA)" <de...@myfaces.apache.org> on 2012/04/19 21:04:40 UTC
[jira] [Reopened] (EXTCDI-262) custom meta-data for @Secured
[ https://issues.apache.org/jira/browse/EXTCDI-262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gerhard Petracek reopened EXTCDI-262:
-------------------------------------
> custom meta-data for @Secured
> -----------------------------
>
> Key: EXTCDI-262
> URL: https://issues.apache.org/jira/browse/EXTCDI-262
> Project: MyFaces CODI
> Issue Type: New Feature
> Components: Core
> Affects Versions: 1.0.3
> Reporter: Gerhard Petracek
> Assignee: Gerhard Petracek
> Fix For: 1.0.4
>
>
> examples:
> #1:
> //...
> @Named
> @Admin
> public class MyBean implements Serializable
> {
> //...
> }
> //...
> @Stereotype
> @Secured(RoleAccessDecisionVoter.class)
> public @interface Admin
> {
> }
> @ApplicationScoped
> public class RoleAccessDecisionVoter implements AccessDecisionVoter
> {
> private static final long serialVersionUID = -8007511215776345835L;
>
> @Inject
> private AccessDecisionVoterContext voterContext;
> public Set<SecurityViolation> checkPermission(InvocationContext invocationContext)
> {
> Admin admin = voterContext.getMetaDataFor(Admin.class.getName(), Admin.class);
> //...
> }
> }
> #2:
> //...
> @Named
> @HasRole("admin")
> public class MyBean implements Serializable
> {
> //...
> }
> //...
> @Stereotype
> @Secured(TestAccessDecisionVoter.class)
> public @interface HasRole
> {
> String value();
> }
> @ApplicationScoped
> public class RoleAccessDecisionVoter implements AccessDecisionVoter
> {
> private static final long serialVersionUID = -8007511215776345835L;
>
> @Inject
> private AccessDecisionVoterContext voterContext;
> public Set<SecurityViolation> checkPermission(InvocationContext invocationContext)
> {
> HasRole hasRole = voterContext.getMetaDataFor(HasRole.class.getName(), HasRole.class);
> String roleName = hasRole.value();
> //...
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira