All Projects → PlaidWeb → Authl

PlaidWeb / Authl

Licence: MIT License
A library for managing federated identity

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to Authl

Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+5370%)
Mutual labels:  oauth, oauth2-client
Doorkeeper
Doorkeeper is an OAuth 2 provider for Ruby on Rails / Grape.
Stars: ✭ 4,917 (+24485%)
Mutual labels:  identity, oauth
Flask Oauthlib
YOU SHOULD USE https://github.com/lepture/authlib
Stars: ✭ 1,429 (+7045%)
Mutual labels:  oauth, oauth2-client
Monkey
Monkey is an unofficial GitHub client for iOS,to show the rank of coders and repositories.
Stars: ✭ 1,765 (+8725%)
Mutual labels:  oauth, oauth2-client
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+11515%)
Mutual labels:  identity, oauth
Retroauth
A library build on top of retrofit, for simple handling of authenticated requests
Stars: ✭ 405 (+1925%)
Mutual labels:  oauth, oauth2-client
Aspnetcore Webapi Course
Professional REST API design with ASP.NET Core 3.1 WebAPI
Stars: ✭ 323 (+1515%)
Mutual labels:  identity, oauth
Oauthswift
Swift based OAuth library for iOS
Stars: ✭ 2,949 (+14645%)
Mutual labels:  oauth, oauth2-client
Home
Welcome to Janssen: the world's fastest cloud native identity and access management platform
Stars: ✭ 176 (+780%)
Mutual labels:  identity, oauth
Security.identity
.NET DevPack Identity is a set of common implementations to help you implementing Identity, Jwt, claims validation and another facilities
Stars: ✭ 165 (+725%)
Mutual labels:  identity, oauth
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+59320%)
Mutual labels:  identity, oauth
Authing
🔥Authing - IDaaS/IAM solution that can Auth to web and mobile applications.
Stars: ✭ 247 (+1135%)
Mutual labels:  identity, oauth
Identityserver
An open-source, standards-compliant, and flexible OpenID Connect and OAuth 2.x framework for ASP.NET Core
Stars: ✭ 223 (+1015%)
Mutual labels:  identity, oauth
react-google-oauth2.0
React frontend login with OAuth 2.0 & integrates a Rest API backend.
Stars: ✭ 14 (-30%)
Mutual labels:  oauth, oauth2-client
ConfTalks
⚠️ Development is currently on hold 🎥 An open source index of already recorded and scheduled conference talks to help you decide if you should go. Built for all developers 👩‍💻👨‍💻
Stars: ✭ 53 (+165%)
Mutual labels:  backend
UPES-SPE-Fest
An Instagram like Social Networking Android App for UPES SPE Fest using Firebase as backend.
Stars: ✭ 39 (+95%)
Mutual labels:  backend
aionic-core
The core API required for all other Aionic applications
Stars: ✭ 106 (+430%)
Mutual labels:  backend
andresrodriguez55.github.io
Personal blog and portfolio with administration panel, notification system and comment system.
Stars: ✭ 18 (-10%)
Mutual labels:  backend
SimpleOAuth
Simple OAuth 2.0 for Android
Stars: ✭ 15 (-25%)
Mutual labels:  oauth2-client
bootstrap helper
Bootstrap Helper für REDAXO 5
Stars: ✭ 22 (+10%)
Mutual labels:  backend

Authl

A Python library for managing federated identity

Documentation Status

About

Authl is intended to make it easy to add federated identity to Python-based web apps without requiring the creation of site-specific user accounts, but also without requiring the user to choose from a myriad of buttons or links to select any specific login provider.

All it should take is a single login form that asks for how the user wants to be identified.

Current state

The basic API works, and provides an easy drop-in set of endpoints for Flask.

Currently supported authentication mechanisms:

  • Directly authenticating against email using a magic link
  • Federated authentication against Fediverse providers (Mastodon, Pleroma)
  • Federated authentication against IndieAuth
  • Silo authentication against Twitter
  • Test/loopback authentication for development purposes

Planned functionality:

  • Pluggable OAuth mechanism to easily support additional identity providers such as:
    • OpenID Connect (Google et al)
    • Facebook
    • GitHub
  • OpenID 1.x (Wordpress, LiveJournal, Dreamwidth, etc.)
  • A more flexible configuration system

Rationale

Identity is hard, and there are so many competing standards which try to be the be-all end-all Single Solution. OAuth and OpenID Connect want lock-in to silos, IndieAuth wants every user to self-host their own identity site, and OpenID 1.x has fallen by the wayside. Meanwhile, users just want to be able to log in with the social media they're already using (siloed or not).

Any solution which requires all users to have a certain minimum level of technical ability is not a workable solution.

All of these solutions are prone to the so-called "NASCAR problem" where every supported login provider needs its own UI. But being able to experiment with a more unified UX might help to fix some of that.

Documentation

Full API documentation is hosted on readthedocs.

Usage

Basic usage is as follows:

  1. Create an Authl object with your configured handlers

    This can be done by instancing individual handlers yourself, or you can use authl.from_config

  2. Make endpoints for initiation and progress callbacks

    The initiation callback receives an identity string (email address/URL/etc.) from the user, queries Authl for the handler and its ID, and builds a callback URL for that handler to use. Typically you'll have a single callback endpoint that includes the handler's ID as part of the URL scheme.

    The callback endpoint needs to be able to receive a GET or POST request and use that to validate the returned data from the authorization handler.

    Your callback endpoint (and generated URL thereof) should also include whatever intended forwarding destination.

  3. Handle the authl.disposition object types accordingly

    A disposition is what should be done with the agent that initiated the endpoint call. Currently there are the following:

    • Redirect: return an HTTP redirection to forward it along to another URL
    • Notify: return a notification to the user that they must take another action (e.g. check their email)
    • Verified: indicates that the user has been verified; set a session cookie (or whatever) and forward them along to their intended destination
    • Error: An error occurred; return it to the user as appropriate

Flask usage

To make life easier with Flask, Authl provides an authl.flask.AuthlFlask wrapper. You can use it from a Flask app with something like the below:

import uuid
import logging

import flask
import authl.flask

logging.basicConfig(level=logging.INFO)
LOGGER = logging.getLogger(__name__)

app = flask.Flask('authl-test')

app.secret_key = str(uuid.uuid4())
authl = authl.flask.AuthlFlask(
    app,
    {
        'SMTP_HOST': 'localhost',
        'SMTP_PORT': 25,
        'EMAIL_FROM': '[email protected]',
        'EMAIL_SUBJECT': 'Login attempt for Authl test',
        'INDIELOGIN_CLIENT_ID': authl.flask.client_id,
        'TEST_ENABLED': True,
        'MASTODON_NAME': 'authl testing',
        'MASTODON_HOMEPAGE': 'https://github.com/PlaidWeb/Authl'
    },
    tester_path='/check_url'
)


@app.route('/')
@app.route('/some-page')
def index():
    """ Just displays a very basic login form """
    LOGGER.info("Session: %s", flask.session)
    LOGGER.info("Request path: %s", flask.request.path)

    if 'me' in flask.session:
        return 'Hello {me}. Want to <a href="{logout}">log out</a>?'.format(
            me=flask.session['me'], logout=flask.url_for(
                'logout', redir=flask.request.path[1:])
        )

    return 'You are not logged in. Want to <a href="{login}">log in</a>?'.format(
        login=flask.url_for('authl.login', redir=flask.request.path[1:]))


@app.route('/logout/')
@app.route('/logout/<path:redir>')
def logout(redir=''):
    """ Log out from the thing """
    LOGGER.info("Logging out")
    LOGGER.info("Redir: %s", redir)
    LOGGER.info("Request path: %s", flask.request.path)

    flask.session.clear()
    return flask.redirect('/' + redir)

This will configure the Flask app to allow IndieLogin, Mastodon, and email-based authentication (using the server's local sendmail), and use the default login endpoint of /login/. The index() endpoint handler always redirects logins and logouts back to the same page when you log in or log out (the [1:] is to trim off the initial / from the path). The logout handler simply clears the session and redirects back to the redirection path.

The above configuration uses Flask's default session lifetime of one month (this can be configured by setting app.permanent_session_lifetime to a timedelta object, e.g. app.permanent_session_lifetime = datetime.timedelta(hours=20)). Sessions will also implicitly expire whenever the application server is restarted, as app.secret_key is generated randomly at every startup.

Accessing the default stylesheet

If you would like to access authl.flask's default stylesheet, you can do it by passing the argument asset='css' to the login endpoint. For example, if you are using the default endpoint name of authl.login, you can use:

flask.url_for('authl.login', asset='css')

from Python, or e.g.

<link rel="stylesheet" href="{{url_for('authl.login', asset='css')}}">

from a Jinja template.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].