Skip to main content

Simple Apereo Central Authentication Service (CAS) client

Project description

cassyy

A simple Apereo Central Authentication Service (CAS) client that provides basic support for validating service tickets using CAS Protocols 2/3. It uses the Python standard library urllib.request module and has no external dependencies.

Usage

Below provides just an example of how it might be used in a web application. The example is generic and does not represent any specific web framework. It is up to the application to decide what service_url it will use with the build_login_url method. It is common to use the current request url or a fixed url that CAS will redirect the user to after the login is successful along with a ticket that can be validated to retrieve information about the user.

import cassyy

cas_client = cassyy.CASClient.from_base_url('https://cas.example.org')

def login_route(request, response):
    redirect_url = ...
    target_url = cas_client.build_login_url(redirect_url)
    response.redirect(target_url)

# This could be a route or some authentication middleware that intercepts
# unauthenticated requests and redirects to CAS and/or validates a CAS ticket
# if one is included in the request.
def validate_route(request, response):
    ticket = ...  # pull from request
    service_url = ...
    cas_user = cas_client.validate(service_url, ticket)
    request.session['user'] = cas_user.asdict()

def logout_route(request, response):
    # where to have CAS redirect back to the app after the CAS logout occurs,
    # or None to use the CAS logout page
    service_url = ...
    target_url = cas_client.build_logout_url(service_url)
    response.redirect(target_url)

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

cassyy-1.0.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

cassyy-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file cassyy-1.0.0.tar.gz.

File metadata

  • Download URL: cassyy-1.0.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cassyy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3045ab72f5b5701adb08a6addc89a7e744e5bf8a60f6e3cefbac902ccc4909b1
MD5 9d1503c5a48ff0b100b6b6d421ffacbd
BLAKE2b-256 5fcebbf07f75d4f688832f5dd73b4352a31d92ddbadb7fec54828deb830cd96f

See more details on using hashes here.

File details

Details for the file cassyy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cassyy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cassyy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa6d5275b573b0464ac90fbe432701f62bdcd49f0c985b1d3c3e3a1907947eab
MD5 6ff6baa9f78a1763ad5136d0f20ecae0
BLAKE2b-256 de9f7ce0d2681da9ea24890df2ac9d38c094e9d67f15d860322fbc199e8172c2

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