Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:50:26+00:00 2026-05-16T23:50:26+00:00

for security reasons, we want to block users by IP adress in our application,

  • 0

for security reasons, we want to block users by IP adress in our application, if they are trying to login as admin and they type in the a wrong password 3 times.

It is very easy to get the IP Adress of the user trying to login. I use this code snippet to get the IP:

ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest)context.getRequest();
String ip = request.getRemoteAddr();

We are using JBoss 5.1.0 GA and Seam 2.2.1.CR2. As far as I know, there is no way to block IP addresses in Seam. But is it possible to call JBoss functions to block a specific IP?

Please let me know if Seam has some support for this 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:50:26+00:00Added an answer on May 16, 2026 at 11:50 pm

    This should be very easy to do.

    Assuming you have an application scoped Set with all the ip’s you want to block you can use this filter:

    @Startup
    @Scope(ScopeType.APPLICATION)
    @Name("ipFilter")
    @BypassInterceptors
    @Filter(around ="org.jboss.seam.web.ajax4jsfFilter")
    public class IpFilter extends AbstractFilter {
    
      public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
              throws IOException, ServletException {
    
          if (!(req instanceof HttpServletRequest)) {
              chain.doFilter(req, res);
              return;
          }
    
          HttpServletRequest request = (HttpServletRequest) req;
    
          Set<String> ips = (Set<String>)Component.getInstance("blockedIps");
          if(ips.contains(request.getRemoteAddr())) {
            throw new ServletException("Permission denied");
          }
    
          chain.doFilter(req, res);
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for security reasons i want the users on my website not to be able
I want to prevent users from signing up with a password = login for
There are many security reasons why one would want to drop an HTTP connection
So for security reasons, I want to disallow http://www.domain.com/directory/ but allow that physical directory
For security reasons, my website automatically signs users out after 5 minutes of inactivity.
I've got a web application with approx. 30k users and growing fast. We want
For data security and privacy reasons I want to know why Magento uses two
I'm looking for a method to drop process rights for security reasons. I want
i want to translate this below: <?php echo __(<<<EOM <p> For security reasons... </p>
I got a Selenium server all set up, and for security reasons, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.