soung
soung

Reputation: 1614

alfresco get ip address after authentication

In Share is there a way to get user ip adress after authentication in alfresco ?

If yes how ?

Based on this ip adress i want to allow or forbid acces to repository.

I'am using alfresco 5.0.d

Thank you in advance.

EDIT 1 :

The user can connect to alfresco but can only enter to the repository when certain conditions are verified. Simply, on my alfresco there are 2 roles (ROLE1 and ROLE2). Users with the ROLE1 can enter to Afresco anywhere. But a user with the ROLE2 can access to alfresco only when he is on a particular network (network identified by a ip address).

To verify the role of the user i need him to be connected. I hope I am clear enough !

Upvotes: 0

Views: 390

Answers (1)

Teqnology
Teqnology

Reputation: 1298

If I understand this correctly, you want to disable access for specific IP's on your Alfresco instance. If so. there is no need to check the request, nor make useless Java back end webscripts. Just set up either: 1. Apache or Nginx in front of your alfresco. or 2. Configure tomcat with proper <valve> tag configuration. Here you'll find a quick guide I wrote years ago, but it should still give you an idea or what to do or where to look: http://alch3mi5t.blogspot.com/2012/04/tomcat-valve-configuration.html Also, here you'll find more examples and tutorials: Tomcat Restrict access by IP address

<Engine name="Catalina" defaultHost="localhost">
   ...
   ...
   ...
   <Valve className="org.apache.catalina.valves.RemoteAddrValve"
       allow="10\.132\.77\.55|10\.132\.76\.120|10\.132\.77\.47"/>
   ...
</Engine>

EDIT: a quick question: why would you leave the Login accessible if users can't log in (disabling access after authentication?). This way you just expose a non-authenticated page and you're good :)

Upvotes: 1

Related Questions