myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Petracek (Created) (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Created] (EXTCDI-262) custom meta-data for @Secured
Date Thu, 02 Feb 2012 14:03:55 GMT
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


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

        

Mime
View raw message