• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

EJP's @RolesAllowed({""})

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi...i have a database table SUPPLIERS and i have used netbeans wizards to generate an entity class from the table, then to generate a jsf page from from the Supplier entity class.

the net beans created a managed bean called SupplierController for me and an ejb called SupplierFacade...and its ok and runs so good.

now, i want to add some authentication on the creation of suppliers, so i have made the following

1-adjust the supplierFacade

@Stateless
@DeclareRoles({"USERS"})
public class SupplierFacade {
.
.
@RolesAllowed({"USERS"}) //USERS is a security rule
public void create(Supplier supplier) {
em.persist(supplier);
.
.
}
2-from the glassFish admin-console, i hav added a file user to a group list called bank_users
3-add to the sun-web.xml the following lines
<security-role-mapping>
<role-name>USERS</role-name>
<group-name>bank_users</group-name>
</security-role-mapping>


and i expect the application to prompt me for a user name and password when i click save link after filling the fields of the new supplier, but i only hav the following exception and nothing added to the database

WARNING: A system exception occurred during an invocation on EJB SupplierFacade method public void com.shady.compamy.DATA.SupplierFacade.create(com.shady.compamy.DATA.Supplier)
javax.ejb.AccessLocalException: Client not authorized for this invocation.


can anybody help me??
thanks inadvance:)

 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic