Thanks Nathan for sharing your experience with the leap to DS.
On Tue, Sep 3, 2013 at 11:52 AM, Nathan Dennis <[email protected]>wrote: > Kelly, > It really depends on your needs. When I made the leap to DS, I > had the same questions and did the same research. Cody's app example is > very helpful and you will need parts of it even if you choose to go with > Picketlink as I did. In my case, I had need of both role and group based > securities, ldap integration (wrote my own there) and security both at the > bean and presentation layers. Most of the functionality from Seam can be > gained again simply by thinking outside the box with the picketlink tools, > the DS modules currently available and a few things from Cody's example. > > > > > 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: Cody Lerum [mailto:[email protected]] > Sent: Tuesday, September 03, 2013 10:42 AM > To: [email protected] > Subject: Re: simple authentication > > I threw https://github.com/codylerum/simple-identity together. > > Haven't gotten around to publishing to central. > > Very simple. > On Sep 3, 2013 7:44 AM, "Kelly Goedert" <[email protected]> wrote: > > > Thanks. I will try picketlink/box > > > > > > On Tue, Sep 3, 2013 at 10:42 AM, <[email protected]> > wrote: > > > > > Hi, > > > > > > DeltaSpike doesn't provide an authentication mechanism. > > > > > > You could integrate Picketlink/Box or build your own. With an own > > producer > > > for current user (Take care of the annotation) you have nearly the > > > same like seam. And for some role checking you can build an easy > > > helper class too. I did the last way and included something like that: > > > > > > @Named(value = "authenticator") > > > @SessionScoped > > > public class Authenticator implements Serializable { > > > > > > /** > > > * Serial Version UID > > > */ > > > private static final long serialVersionUID = 1L; > > > > > > > > > > > > @Inject > > > private UserServiceLocal userService; > > > > > > private String loginName; > > > private String password; > > > > > > private User currentUser; > > > > > > > > > public String authenticate() { > > > if (null != currentUser) { > > > return "home?faces-redirect=true"; > > > } > > > currentUser = userService.findByLoginName(**loginName); > > > if (null != currentUser) { > > > if(currentUser.getPassword().**equals(password)) { > > > return "home?faces-redirect=true"; > > > } > > > currentUser = null; > > > } > > > return "index?faces-redirect=true"; > > > } > > > > > > public String logout() { > > > currentUser = null; > FacesContext.**getCurrentInstance().** > > > getExternalContext().**invalidateSession(); > > > return "index?faces-redirect=true"; > > > } > > > > > > @Named > > > @Produces > > > @CurrentUser > > > public User getCurrentUser() { > > > return currentUser; > > > } > > > > > > /** > > > * @return the password > > > */ > > > public String getPassword() { > > > return password; > > > } > > > > > > /** > > > * @param password the password to set > > > */ > > > public void setPassword(String password) { > > > this.password = password; > > > } > > > > > > public String getLoginName() { > > > return loginName; > > > } > > > > > > public void setLoginName(String loginName) { > > > this.loginName = loginName; > > > } > > > } > > > > > > @Named > > > @ViewScoped > > > public class Security implements Serializable { > > > > > > /** > > > * Serial Version UID > > > */ > > > private static final long serialVersionUID = 1L; > > > > > > @Inject > > > @CurrentUser > > > private User user; > > > > > > @Inject > > > private SecurityServiceLocal securityService; > > > > > > private List<String> roleNames; > > > > > > @PostConstruct > > > public void init() { > > > if (null != user) { > > > roleNames = new ArrayList<String>(); > > > > > > for (SecurityRole role : > > securityService.loadUserRoles(**user)) > > > { > > > roleNames.add(role.getName()); > > > } > > > > > > } > > > } > > > > > > public boolean hasRole(String roleName) { > > > if (null != roleNames && !roleNames.isEmpty() && null != > > roleName) > > > { > > > return roleNames.contains(roleName); > > > } > > > return false; > > > } > > > > > > public boolean isAdmin() { > > > if (null != roleNames && !roleNames.isEmpty()) { > > > return roleNames.contains("ADMIN"); > > > } > > > return false; > > > } > > > > > > public boolean isLoggedIn() { > > > if (null != user) { > > > return true; > > > } > > > return false; > > > } > > > > > > Kind Regards > > > Florian > > > > > > > > > Quoting Kelly Goedert <[email protected]>: > > > > > > Hi, > > >> > > >> I have a very simple application working with seam 3. It has a > > >> login > > and a > > >> simple crud. Now I would like to migrate this simple example to > > >> deltaspike. > > >> I simply added deltaspike core and security dependencies, but I am > > missing > > >> the dependencies for BaseAuthenticator and Authenticator interface. > > >> > > >> What dependencies I am missing? Is there an example on doing a > > >> simple authentication process? > > >> > > >> 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. >
