Skip to main content

An extension that generates a one-time login link for a user

Project description

LET ME IN!

Tests

A CKAN extension that provides secure one-time login functionality and optional admin impersonation capabilities.

Overview

ckanext-let-me-in generates one-time login links (OTL) that allow users to access their accounts without passwords. The extension consists of two components:

  • Core plugin: Generates secure one-time login links via API or CLI
  • Impostor subplugin: Provides a web UI for sysadmins to login as other users

Requirements

CKAN Version Compatibility
2.8 and earlier ❌ Not supported
2.9 ⚠️ Not tested
2.10 ✅ Supported
2.11 ✅ Supported
master ⚠️ Not tested

Installation

Standard Installation

pip install ckanext-let-me-in

Developer Installation

git clone https://github.com/DataShades/ckanext-let-me-in.git
cd ckanext-let-me-in
pip install -e .

One-Time Login Links

This plugin allows generating secure one-time login links for users, which can be used to access their accounts without needing a password.

Features

  • Generate secure one-time login links for any user by ID, username, or email
  • Multiple access methods: API endpoint and CLI command
  • Configurable expiration (default: 24 hours)
  • Links expire after first use or TTL timeout
  • Secure token generation and validation

Configuration

Add the plugin to your CKAN configuration:

ckan.plugins = let_me_in

Configuration Options

Setting Description Default Example
ckanext.let_me_in.otl_link_ttl Time in seconds that OTL links remain valid 86400 (24 hours) 3600 (1 hour)
ckan.auth.route_after_login Allows to customize the route that the user will get redirected to after a successful login. dashboard.datasets dataset.search

Usage

API Usage

Use the lmi_generate_otl action to generate links programmatically:

result = tk.get_action('lmi_generate_otl')(
    context,
    {'uid': 'rsmith', 'ttl': 3600}  # Optional TTL override
)

CLI Usage

Generate links from the command line:

ckan letmein uli --name=rsmith
ckan letmein uli --mail=rsmith@ckan.example.com
ckan letmein uli --uid=0daa9f1d-671a-49f3-a7a6-15f4a263ef49 --ttl=3600

Impostor Subplugin

This optional subplugin allows system administrators to impersonate other users via a web interface for a limited time.

impostor admin page

[!WARNING] This feature is not intended for use in a production environment. It should be used only for testing and troubleshooting.

Features

  • Web-based interface for system administrators
  • Login as any user directly from admin panel or user profile pages
  • Easy switch back to original admin account
  • Visual indicators when impersonating users
  • Generate OTL links for users from the UI

Configuration

Enable both plugins in your CKAN configuration:

ckan.plugins = let_me_in let_me_in_impostor

Configuration Options

Setting Description Default Example
ckanext.let_me_in.impostor.ttl Impostor session timeout in seconds 900 (15 minutes) 7200 (2 hours)
ckanext.let_me_in.impostor.show_toolbar_button Show a link to the Impostor interface in the toolbar for sysadmins true false
ckanext.let_me_in.impostor.session_records_per_page Number of session records to show per page in the Impostor admin interface 10 50

Usage

  1. Access the feature: System administrators will see "Login as this user" buttons in:

    • User management pages in the admin panel
    • Individual user profile pages
  2. Impersonate a user: Click the button to instantly login as that user without requiring their password

  3. Return to admin account: Use the provided interface to switch back to your original administrator account at any time

Security Notes

  • Only system administrators can access impersonation features
  • All impersonation activities will be logged for audit purposes
  • Impostor sessions have configurable timeouts for added security

Testing

Run the test suite:

pytest --ckan-ini=test.ini

License

AGPL

Project details


Download files

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

Source Distribution

ckanext_let_me_in-1.1.1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_let_me_in-1.1.1-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_let_me_in-1.1.1.tar.gz.

File metadata

  • Download URL: ckanext_let_me_in-1.1.1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for ckanext_let_me_in-1.1.1.tar.gz
Algorithm Hash digest
SHA256 346dd988d4cdece847cf70317bf5b8cb754462aad02b4eff355ea5d3f989d4d1
MD5 01ad273cac2824aa963b9f6a33b5b302
BLAKE2b-256 e50ae9242238ce1da76d32787c0ae51855cc87f747b3d3a8afd728027ed09632

See more details on using hashes here.

File details

Details for the file ckanext_let_me_in-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_let_me_in-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 111093fbdb3723df6e0c5d7681e174f92db886af1a557f983d0e46acbd3b0dc7
MD5 bad1a5dacce0ed3fac67626b193e7808
BLAKE2b-256 f3a3afb758fc4790482bf4928ab659274beed881295e6b8872964704c738fd22

See more details on using hashes here.

Supported by

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