I have my own realm classes extends AppservPasswordLoginModule and AppservRealm where I get user and roles from my own table in database. In web.xml I defined access to pages and it works. I have some mechanism to read main menu from my menu.xml file in my bean with @SessionScoped annotation. I want to use rules from web.xml to display only this items, which user has acces to (defined in web.xml), without repeating configuration in my menu.xml file. I imagine that the solution might be to check the access to the page when I create menu item for this page in my SessionScoped bean, but I don't know how it could be checked easily. What is the best solution for this situation? I'm using glassfish 4.1 and jsf 2.2.
Display menu items depending on user roles defined in web.xml
512 Views Asked by witek At
1
There are 1 best solutions below
Related Questions in JSF
- Calling custom AuthenticationHandler from Faces bean throws IllegalStateException: Cannot change buffer size after data has been written
- Force security constraint managed 403 error when hitting restricted page with h:commandLink
- primefaces component id not found in update
- LazyDataModel, custom filter with search button
- How to use SelectManyCheckbox with ArrayList as HashMap value
- how to surpress logging of jsf "There are some unhandled FacesMessages"
- SelectManyCheckbox returns array of Object[] instead of ArrayList
- My dialog component on PrimeFaces can't render a list on first click
- How to retrieve posted data via FacesContext
- I'm using JSF and after a timer expires, I want to display a warning
- Why print result is blank?
- PrimeFaces centering searchbar on menubar
- JSF: p:fileUpload requiredmessage is apearing on click of another button
- How can I make sure that JSF works?
- Is there an already-made template project using Spring, JSF, PrimeFaces, SOAP and MySQL?
Related Questions in AUTHENTICATION
- Authenticate Flask rest API
- Sends a personalised error message from the back-end to the front-end with Nuxt-auth
- How to connect Spotify PKCE Authorization Boilerplate to Login-Button in React
- Laravel SPA auth with Sanctum
- _supabaseClient__WEBPACK_IMPORTED_MODULE_1__.supabase.auth.signIn is not a function
- My openID Authentication return 'You must have either https wrappers or curl enabled.'
- How to detect the Minimization of Custom Chrome Tabs on Android?
- Wordpress redirect to homepage after successfully logged in
- How to modify the prebuilt UI of authentication in aws amplify version 6 in React Native
- Creating a login system for my website, navlist not working?
- Receiving 400 bad request on post when customer auth handler is used
- Creating Azure B2B login system with Vue.js frontend & Python Django backend
- Gradio chatbot: how to export individual conversation histories?
- Set-Cookie header not forwarded by nginx to the client
- git asking for authentication when auth.json is present while running composer update
Related Questions in WEB.XML
- In Web.xml Getting error <?xml version="1.0" encoding="UTF-8"?>
- In a web.xml, can the url-pattern of servlet-mapping containing more than one path component? (e.g. /path/to/*))
- Richfaces 3.x - Spring Boot - Migrate web.xml
- Jersey Web.xml Configuration
- Problem with deploying a spring 6 + spring-security 6 + jsf 3.0 application to the payara 6 server
- Add a new JAX-RS resource to web.xml servlet mapping
- Is there a way to define required parameter in web.xml in java servlet
- Deny access to specfic route in web.xml - Java
- Spring Security - avoiding in-web-container role binding removes flexibility
- HSTS header missing error even its show in application with preload (and http port also disable)
- Eclipse web.xml "Referenced file contains errors"
- Eclipse web.xml "The error was detected when validating the file jakartaee_10.xsd"
- Swagger and Spring MVC (non-spring-boot)
- IntelliJ all of Controllers could not autowired all of Services after context seperation
- JasperReport PDF displayed unrecognized binary after hardening Tomcat 7 web.xml
Related Questions in CONDITIONAL-RENDERING
- Unexpected behaviour when conditionally rendering the same input component with different defaultValue
- Render different pages on same route but for different subdomains in a single nextjs app
- how to know if the app is on the not found page in nextjs 14 app router
- Input element is not displaying
- Render React child component with conditional rendering and one general wrapping html element
- Re-rendering conditional buttons
- Media Viewer in React: Displaying Single and Multiple Images from Firebase Storage
- Is component duplication for responsive display in react a good idea?
- Showing the raw json data on refreshing the page
- Conditional styling not working as intended
- Javascript HTML conditional display table of rows looses table column alignment
- How conditionally add an HTML attribute to an element in Astro
- Conditionally render images which are meant to serve as only background elements for body so they don't add height on pages with too little content
- jsx conditional rendering won't update on state change
- How to Implement Role-Based Access Control for Functionalities and Pages in React?
Related Questions in SECURITY-CONSTRAINT
- Force security constraint managed 403 error when hitting restricted page with h:commandLink
- <security-constraint> programmatically Tomcat
- i would like to apply security constraints ,that allows only http methods like Get ,post only
- How to set auth role programically for tomcat 8.5
- Httpservletrequest.authenticate() method not sending redirection to login page
- Are there side effects of having an empty security-constraint tag in your web.xml file?
- security constraints using web.xml jsp outside web-inf
- How Can I Hide / Encrypted my Python(Django or Flask) sourcecode from Clients?
- Why can't any authorizations can access my service even though I already have Security constraint in web.xml?
- Mapping role-names to from roles
- How to add CorsFilter along with Security-constraints in apache tomee?
- Role-names available on Google App Engine
- tomcat 7 web.xml hierarchy - users and roles - java servlet
- Websphere extendedDocumentRoot how to restrict by security role
- Configuring an exception in web.xml security-constraint
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I solved this by the following method:
In my ServletListener
I read security-constraint from web.xml, parsing them and store it in my @ApplicationScoped bean.
In @SessionScoped bean, in @PostConstruct annotated method I get all roles stored in @ApplicationScoped bean and checked each individual by
method.
So I have all current user roles. Then, in my @SessionScoped bean, for each menu item I check whether the resource represented by the url of this menu item is available for roles that current user has.
EDIT: The bad side of this solution is that I analyzing the web.xml file only, without annotations