Code Monkey home page Code Monkey logo

authnzerver's Issues

add a user_lock function

This will be used to lock users by:

  • setting is_active = False
  • setting user_role = 'locked'

This should go in actions.users.

add in a full example of a login/logout frontend using BaseHandler

This won't use bootstrap or JS. Just Tornado templates, basic CSS and HTML, and normal POST/GET queries.

  • consider adding in social login support with all the client redirect bits required. See #9 for the backend work required.
  • also add in an API key authentication example.

Username creation has failed but I still get a 200 status message, stack trace attached

[W 200703 08:06:34 user:223] [6kD6rhaNw3kZH3s-] Password for new account with email: 497a592fa499aa87 matches FQDN (similarity: 9.5), their name (similarity: 52.6),  or their email address (similarity: 21.4).
[E 200703 08:06:34 user:813] [6kD6rhaNw3kZH3s-] User creation request failed for email: 497a592fa499aa87. The password provided is not secure.
[I 200703 08:06:34 web:2246] 200 POST / (172.20.0.12) 132.95ms
[W 200703 08:10:36 user:171] [D2OQzoBih0lfKrmz] Password for new account with email: 973fc743a79a211a is too short (9 chars < required 12).
[W 200703 08:10:36 user:223] [D2OQzoBih0lfKrmz] Password for new account with email: 973fc743a79a211a matches FQDN (similarity: 9.5), their name (similarity: 52.6),  or their email address (similarity: 20.7).
[E 200703 08:10:36 user:813] [D2OQzoBih0lfKrmz] User creation request failed for email: 973fc743a79a211a. The password provided is not secure.
[I 200703 08:10:36 web:2246] 200 POST / (172.20.0.12) 98.45ms```

add a auth_delete_all_sessions function

This will go here:

def auth_kill_old_sessions(

The use-case is to support a "delete all my other sessions" function (we'll have an optional payload key for the current session token if called by a user themselves so they don't delete their current session). And also to clear all sessions for a user who must be locked everywhere.

add use of environmental vars to config everything

Also add a check for authdb emptiness if the DB URL is provided and do autosetup if it's empty.

The list of environ vars to add awareness of (from deploy/authnzerver-environ.conf):

# listen address and port settings
AUTHNZERVER_PORT={{ authnzerver_listenport }}
AUTHNZERVER_LISTEN={{ authnzerver_listenaddr }}

# secret token and authentication DB URL
AUTHNZERVER_SECRET={{ authnzerver_secretkey }}
AUTHNZERVER_AUTHDB={{ authnzerver_authdb }}

# cache and base directory locations
AUTHNZERVER_CACHEDIR={{ authnzerver_cachedir }}
AUTHNZERVER_BASEDIR={{ authnzerver_basedir }}

# session expiry time in days and session cookie name
AUTHNZERVER_SESSIONEXPIRY={{ authnzerver_sessionexpiry }}
AUTHNZERVER_SESSIONCOOKIE={{ authnzerver_sessioncookiename }}

# email settings for sending emails to users
AUTHNZERVER_EMAILSENDER={{ authnzerver_emailsender }}
AUTHNZERVER_EMAILSERVER={{ authnzerver_emailserver }}
AUTHNZERVER_EMAILPORT={{ authnzerver_emailport }}
AUTHNZERVER_EMAILUSER={{ authnzerver_emailuser }}
AUTHNZERVER_EMAILPASS={{ authnzerver_emailpass }}

PII_Salt issue when creating a new user

Stacktrace:

authnzerver_1 | [I 200706 09:12:11 web:2246] 200 POST / (172.31.0.16) 1740.56ms
authnzerver_1 | [E 200706 09:17:38 handlers:292] Failed to understand request.
authnzerver_1 | authnzerver.external.futures37.process._RemoteTraceback:
authnzerver_1 | """
authnzerver_1 | Traceback (most recent call last):
authnzerver_1 | File "/home/authnzerver/authnzerver/external/futures37/process.py", line 246, in _process_worker
authnzerver_1 | r = call_item.fn(*call_item.args, **call_item.kwargs)
authnzerver_1 | File "/home/authnzerver/authnzerver/actions/user.py", line 994, in create_new_user
authnzerver_1 | pii_hash(rows['user_id'],payload['pii_salt']))
authnzerver_1 | TypeError: 'NoneType' object is not subscriptable
authnzerver_1 | """
authnzerver_1 |
authnzerver_1 | The above exception was the direct cause of the following exception:
authnzerver_1 |
authnzerver_1 | Traceback (most recent call last):
authnzerver_1 | File "/home/authnzerver/authnzerver/handlers.py", line 213, in post
authnzerver_1 | response = await loop.run_in_executor(
authnzerver_1 | TypeError: 'NoneType' object is not subscriptable
authnzerver_1 | [W 200706 09:17:38 web:2246] 400 POST / (172.31.0.16) 104.35ms
authnzerver_1 | [E 200706 09:21:12 handlers:292] Failed to understand request.
authnzerver_1 | authnzerver.external.futures37.process._RemoteTraceback:
authnzerver_1 | """
authnzerver_1 | Traceback (most recent call last):
authnzerver_1 | File "/home/authnzerver/authnzerver/external/futures37/process.py", line 246, in _process_worker
authnzerver_1 | r = call_item.fn(*call_item.args, **call_item.kwargs)
authnzerver_1 | File "/home/authnzerver/authnzerver/actions/user.py", line 994, in create_new_user
authnzerver_1 | pii_hash(rows['user_id'],payload['pii_salt']))
authnzerver_1 | TypeError: 'NoneType' object is not subscriptable
authnzerver_1 | """
authnzerver_1 |
authnzerver_1 | The above exception was the direct cause of the following exception:
authnzerver_1 |
authnzerver_1 | Traceback (most recent call last):
authnzerver_1 | File "/home/authnzerver/authnzerver/handlers.py", line 213, in post
authnzerver_1 | response = await loop.run_in_executor(
authnzerver_1 | TypeError: 'NoneType' object is not subscriptable
authnzerver_1 | [W 200706 09:21:12 web:2246] 400 POST / (172.31.0.16) 90.67ms

some API key fixes

In here:

random_token = secrets.token_urlsafe(32)

consider encrypting the API key like we do the password (might make things slower though).

In here:

sel = select([
apikeys.c.apikey,
apikeys.c.expires,
]).select_from(apikeys).where(
apikeys.c.apikey == apikey_dict['tkn']
).where(
apikeys.c.user_id == apikey_dict['uid']

We should:

  • check if the API key hasn't expired ('exp' > utcnow())
  • use the secrets.compare_digest() fn to compare instead of doing the equality check in the SQL expression

Make logging more verbose

Obviously we'll never log passwords or PII. Should log the errors, etc. though. Should also:

  • on errors and permissions failures, log session tokens and IP addresses with salted hashes to allow correlation, but not actual info exposure
  • maybe log user IDs?

add in social login support

This will use the Tornado OAuth2, GoogleAuthMixin and TwitterAuthMixins to support for:

  • Twitter
  • Google
  • Github

Should figure out how to do a client redirect bit and put that into the example as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.