title: EJB 3.1 How to block external connection
body: <p>I have a Stateless bean where I want to allow access only to the client that I authorize.</p>
  
  <p>The bean:</p>
  
  <pre><code>@Stateless 
  public class LibraryBean implements LibraryIFace { 
  
     @Override 
     public void setName(String name){ 
    sb.setName( name ); 
     } 
  
     @Override 
     public String getName(){ 
     return sb.getName(); 
     } 
  
     @EJB 
     private SingIFace sb; 
  
  }
  </code></pre>
  
  <p>I know that anyone can access to this bean over the network.</p>
  
  <p>How can I block all connections not trusted?</p>
  
  <p>I using Wildfly.</p>
  
  <p>Thanks in advance Andrea.</p>