Skip to main content

Auth IP integration

What is it?#

This integration allows you to automatically authenticate users coming from an specific IP or IP ranges.

How to configure it?#

  1. Direct
  2. Proxy

Direct#

For both direct and proxy methods the system requires the IP or IP ranges from where the users are expected to connect. In case you're using a proxy, you'll need to configure the IP of the proxy.

In the store:

  1. Go to Control Panel > Users
  2. Create a new user or select an existing one
  3. Set the IP or IP ranges using the option Assing IP ranges in the dropdown menu.

assign-ip

To add a unique IP you should add it in "From" and then press the "Assign" button, leaving "To" empty. In case you need to add an IP range, for example all IPs between 10.0.0.1 to 10.200.200.255, you will setup From: 10.0.0.1 - To: 10.200.200.255 and any user coming from IPs in that range will be automatically logged in.

In the third party end:

  1. Create a button or Hyperlink
  2. Set a route https://your-store.com/auth/ip like link in the button
<a href="https://your-store.com/auth/ip">Login User</a>
<button type="button" onclick="loginUser()">Login User</button>
<script>
function loginUser() {
return window.location.href = 'https://your-store.com/auth/ip';
}
</script>
  1. In case you need to redirect users to a specific URL inside store such as the publication page or a specific filter you may add the intended_url parameter to your URL.
<a href="https://your-store.com/auth/ip?intended_url=https://your-store.com/reader/publication-name">Login User</a>
<button type="button" onclick="loginUser()">Login User</button>
<script>
function loginUser() {
return window.location.href = 'https://your-store.com/auth/ip?intended_url=https://your-store.com/reader/publication-name';
}
</script>

Proxy#

For proxies, first you need to configure the stanza.

You can read more information about stanza structure

HTTPMethod value is needed for a secure connection between proxy and our server and make sure that all works fine. This is because in some cases we need to use PUT request or other kind or request for get or set information.

Example

Title Publicala Editions
HTTPHeader -request -process X-XSRF-TOKEN
HTTPHeader -request -process X-CSRF-TOKEN
HTTPMethod PUT
HTTPMethod PATCH
HTTPMethod DELETE
HTTPMethod OPTIONS
HTTPMethod TRACE
HTTPMethod CONNECT
URL app.publica.la/auth/ip
HJ app.publica.la
DJ app.publica.la

then you need configure all steps for direct configuration. The difference here is the proxy only.

Troubleshooting#

If your integration is not working properly it could be due to the following reasons:

  • Incorrect IP or IP range configured in the system
  • Users connecting from another IP or IP range other than the one configured in the system

In both cases users will be directed to the login form instead of bing automatically logged in. You can add to url query ?debug=true to know IP where come from these user.

https://your-store.com/auth/ip?debug=true

When you use this URL you should see the follow screen show with date to know if the user are configured with correct IPs.

assign-ip