Skip to main content

CookieAuthHelper to redirect only if user agent is a real browser

Project description

Introduction

This is a modified Cookie Auth Plugin that only redirects if the UA is a browser. The main envisioned use case is for scenarios that require an API to be built for an existing client (that we have no control over) that does not expect redirects to login form upon authentication.

The detection is done by comparing the request User-Agent header against some of the most common browser user agent strings, ie. “Mozilla”, “Webkit”, “Opera”, and for the terminal users out there, “Lynx”.

Basic installation and use:

  1. Go to Zope root acl_users folder via ZMI

  2. Add a “Browser-only-redirecting Cookie Auth Helper”.

  3. Go to “plugins” folder

  4. Click “Challenge Plugins” to get to the plugin registry

  5. Disable “credentials_cookie_auth” plugin

  6. Add in its place the plugin (helper) you added in 2.

Make sure the plugin/helper you added is at the top so it’s given a chance to run first.

Then, try authenticating with wrong credentials. You should get a proper 401 Unauthorized response rather than the usual 302 Moved Temporarily (typically causing redirect).

Change history

Changelog

1.0dev (unreleased)

  • Initial release

Download

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

koodaamo.pas.browseronlyredirect-1.0.zip (18.9 kB view details)

Uploaded Source

File details

Details for the file koodaamo.pas.browseronlyredirect-1.0.zip.

File metadata

File hashes

Hashes for koodaamo.pas.browseronlyredirect-1.0.zip
Algorithm Hash digest
SHA256 3bb96b663867c6fc79678ca569ed40d00712ff5647d4f8e00e7f20b0fd0a2dc5
MD5 fa59ae91917fe02a4e1f01f78feb628d
BLAKE2b-256 991983c69c912f102174ae3db97480df448cf86b1d1b77d170f51f4709504cd7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page