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

  1. Install it via pip:

    pip install ckanext-let-me-in
    

    Or from source:

    git clone https://github.com/DataShades/ckanext-let-me-in.git
    cd ckanext-let-me-in
    pip install -e .
    
  2. Add let_me_in to the ckan.plugins setting in your CKAN config file.

  3. Run DB migrations:

    ckan db upgrade -p let_me_in
    

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 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.3.tar.gz (34.3 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.3-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ckanext_let_me_in-1.1.3.tar.gz
Algorithm Hash digest
SHA256 5f2c30e9fe8ed90fc3d9453c91729ba0e52a9ebf703173e52597881df0383fbf
MD5 42f7d66cbec69731cdcd270b9a34f69c
BLAKE2b-256 af7c73fc9f6e99a77cf8eddd28b289b987937636b42be44cfa3c08fc3d6adc26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ckanext_let_me_in-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e33dd419c46adb55a5e217b3ae0a69d2339cfd599095d1cc35896bc506a6c3d2
MD5 63a07590730cafa911a7a6ac69df74ca
BLAKE2b-256 edb18bf7d012e6f3ef08936745fad41f79cfe81e1327f5444379a047930f15c2

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