<commit_before># Example for Kompassi OAuth2 SSO

This is an example of OAuth2 authentication against the [Kompassi](/tracon/kompassi) event management system. The `kompassi_oauth2` directory contains reusable code for your Django application.

## Getting started

First, make sure `kompassi.dev` and `ssoexample.dev` resolve to localhost via `/etc/hosts`:

    127.0.0.1 localhost kompassi.dev ssoexample.dev

Next, install and run development instance of [Kompassi](/tracon/kompassi) if you don't yet have one:

    virtualenv venv-kompassi
    source venv-kompassi/bin/activate
    git clone https://github.com/tracon/kompassi.git
    cd kompassi
    pip install -r requirements.txt
    ./manage.py setup --test # will create an user called "mahti" with password "<PASSWORD>"
    ./manage.py runserver 127.0.0.1:8000
    iexplore http://kompassi.dev:8000

Now, in another terminal, install and run this example:

    source venv-kompassi/bin/activate
    git clone https://github.com/tracon/kompassi-oauth2-example.git
    cd kompassi-oauth2-example
    pip install -r requirements.txt
    ./manage.py migrate
    ./manage.py createsuperuser # use something else than "mahti" for username
    ./manage.py runserver 127.0.0.1:8001
    iexplore http://ssoexample.dev:8001

When you click the "Go to protected page" link, you should be transferred to your Kompassi development instance. Log in with user `mahti` and password `<PASSWORD>`, authorize the example application to receive your user info, and you should see the protected page.

## Configuration

```python<commit_msg>README: no need to create a local superuser<commit_after># Example for Kompassi OAuth2 SSO

This is an example of OAuth2 authentication against the [Kompassi](/tracon/kompassi) event management system. The `kompassi_oauth2` directory contains reusable code for your Django application.

## Getting started

First, make sure `kompassi.dev` and `ssoexample.dev` resolve to localhost via `/etc/hosts`:

    127.0.0.1 localhost kompassi.dev ssoexample.dev

Next, install and run development instance of [Kompassi](/tracon/kompassi) if you don't yet have one:

    virtualenv venv-kompassi
    source venv-kompassi/bin/activate
    git clone https://github.com/tracon/kompassi.git
    cd kompassi
    pip install -r requirements.txt
    ./manage.py setup --test # will create an user called "mahti" with password "<PASSWORD>"
    ./manage.py runserver 127.0.0.1:8000
    iexplore http://kompassi.dev:8000

Now, in another terminal, install and run this example:

    source venv-kompassi/bin/activate
    git clone https://github.com/tracon/kompassi-oauth2-example.git
    cd kompassi-oauth2-example
    pip install -r requirements.txt
    ./manage.py migrate
    ./manage.py runserver 127.0.0.1:8001
    iexplore http://ssoexample.dev:8001

When you click the "Go to protected page" link, you should be transferred to your Kompassi development instance. Log in with user `mahti` and password `<PASSWORD>`, authorize the example application to receive your user info, and you should see the protected page.

## Configuration

```python
{'fraction_non_alphanumeric': 0.08652299774847218, 'fraction_numerical': 0.025088452878739145, 'mean_word_length': 3.8517940717628707, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4748990', 'n_tokens_mistral': 1011, 'n_tokens_neox': 934, 'n_words': 337}