Skip to main content

Template: Basic Python Project

Project description

Meinewaldki Citizen Rest Service

Installation for Kubernetes

You need to have helm and kubectl installed.

Your kubeconfig should be set to the correct cluster (meinewaldki).

kubectl config current-context

Navigate to the configuration directory:

cd config

Keycloak

For keycloak you need to run the following command:

helm install test-keycloak keycloak --namespace citizen-scientist-app

The configurations are in the keycloak/values.yaml file.

Base configuration your endpoint will be https://meinewaldki.anhalt.ai/dev-auth.

To uninstall keycloak run the following command:

helm uninstall test-keycloak --namespace citizen-scientist-app

Settings

Log into keycloak with the following credentials:

Username: admin-dev
Password: PLS_CHG_ME

Add a new realm for guest users.

In the new realm create a new client with the ClientID MeineWaldKIApp. Enable OAuth 2.0 Device Authorization Grant.

After creating the client change the following settings:

Origin: * (should be more restrictive in production, but did not check if this works with a more restrictive setting) Valid Redirect URIs: * (should be more restrictive in production, but did not check if this works with a more restrictive setting)

Add the role guest to the client roles.

Go to Realm Settings. Set SSO Session Idle very high and SSO Session also very high (Sessions).

Set Access Token Lifespan to a very high value (Tokens).

Remove the first name and last name from the required user attributes (User profile).

Installation Rest Service

I will add the automatic deployment through CI/CD later.

The deployment helm is mostly written but the Docker image is not yet in a registry.

Run locally

After Installing keycloak and creating your realms and changing the admin password and or admin user you can run the service locally.

Add the following environment variables to your .env file:

KEYCLOAK_SERVER_URL=https://meinewaldki.anhalt.ai/dev-auth/ (if not changed)
ADMIN_USERNAME=admin_dev (if not changed)
ADMIN_PASSWORD=PLS_CHG_ME (if not changed)
ADMIN_REALM_NAME=master (if not changed)
GUEST_USER_REALM_NAME=YourRealm (I set it to guest-users)

Mark the src directory as source root in your IDE.

Run the main.py file with the working directory set to the root directory of the project.

Endpoints

I did not setup an endpoint for cookies. This should make it easier to test the endpoints.

http://127.0.0.1:5001/citizen-api/guest-user/create -> Create a new guest user http://127.0.0.1:5001/citizen-api/guest-user/check -> Check if Token is valid (Post request) http://127.0.0.1:5001/citizen-api/docs -> Swagger UI (Easy to test the endpoints)

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

basic_python_project-0.0.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

basic_python_project-0.0.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file basic_python_project-0.0.0.tar.gz.

File metadata

  • Download URL: basic_python_project-0.0.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for basic_python_project-0.0.0.tar.gz
Algorithm Hash digest
SHA256 91e7815efb582359ab5e63eb6fa2b0b534d9b5773f40608f1544dcde23a461d8
MD5 169917737a7061a941ca4400d1d6bce6
BLAKE2b-256 50e8b06d497b9092f57645f2e2e4df8dbb802cc868e658bed446d370a5481501

See more details on using hashes here.

File details

Details for the file basic_python_project-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for basic_python_project-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c695ae16609d038506f91dd670734e680322a639250b55fd85a929c7eb8ce1e
MD5 5ec3214823c1dada8fcfee5cecd5c328
BLAKE2b-256 458e27173b5c91fd97037912887e87e33f67c8af83d41f64770478f946233b7c

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