DeltaSpike isn't all about annotations, we simply decided not to do much in the security realm and left that up to other providers. Your code certainly works, may not be the best way to do it, but it works. Have you taken a look at https://github.com/picketlink/picketlink/blob/master/api/src/main/java/org/picketlink/Identity.java ? You'll probably have to use a producer for it, but it looks like it should give you what you need.
On Wed, Sep 4, 2013 at 11:57 AM, Nathan Dennis <[email protected]>wrote: > Multiple ways of going about this... but since DS was all about > annotations (and Mark and Jason will probably laugh at this.. but) > > @Named("inlineSecuritiesBean") > @RequestScoped > public class InlineSecuritiesBean { > > > public boolean isAdmin(){ > boolean result = false; > try { > result = executeAdmin(); > } catch (Exception e) { > //e.printStackTrace(); > //log something > } > return result; > } > > @Admin > private boolean executeAdmin() { > return true; > } > > > ...... > Used this type of structure for each of my roles I defined. Not quite as > slick as the old seam way.. but this way I could use it pretty much > anywhere without extending or maintaining a session bean with a role list > in it and test with the whole array.contains mess. just use the annotations > and let DS do the rest. > > > > > best regards, > > Nathan Dennis | Software Developer > 732 Greenwood Street | Albemarle, NC | 28001 > Main (800) 230-7525 | Direct: 704-986-7211 | Mobile 704.984.0829 > www.monarchnc.org | [email protected] > > > > -----Original Message----- > From: Kelly Goedert [mailto:[email protected]] > Sent: Wednesday, September 04, 2013 1:50 PM > To: users > Subject: deltaspike and authorization > > Hi, > > using the direction given to me in my previous question, I was able to > implement an authentication mechanism in my app using picketlink. > > I remember that in seam 3, I could use something like this on a xhtml > <h:commandButton ... rendered="#{identity.hasRole('some role name')}"> > > I could not find this in picketlink. According to this page > https://docs.jboss.org/author/display/SECURITY/PicketBox+CDI#PicketBoxCDI-IdentityManagement > it > is not available. Is there anything on deltaspike to implement this? > > Or I should be asking this on a picketlink forum? > > Thanks > > Kelly > > > [http://monarchnc.org/images/monarch/env.png]Please consider the > environment before printing this email. > WARNING: This email is intended solely for the person or entity to which > it is addressed and may contain confidential and/or privileged information. > Any review, dissemination, copying, printing or other use of the email by > persons or entities other than the addressee is prohibited. If you have > received this email in error, please contact the sender immediately and > delete the material from any computer. If you are unable to determine the > sender of this email, please email Monarch at [email protected] or > contact us at toll free (800) 230-7525, and advise us of the error. > -- Jason Porter http://en.gravatar.com/lightguardjp
