diff --git a/login/forms.py b/login/forms.py deleted file mode 100644 index ed80ed06dcce4140c6b0efb82043fa5df016b4da..0000000000000000000000000000000000000000 --- a/login/forms.py +++ /dev/null @@ -1,10 +0,0 @@ -from wtforms import SubmitField, StringField, PasswordField, BooleanField, HiddenField, validators -from flask_wtf import FlaskForm - - -class LoginForm(FlaskForm): - username = StringField("Username", validators=[validators.input_required()],) - password = PasswordField("Password", validators=[validators.input_required()]) - challenge = HiddenField("challenge") - remember = BooleanField("Remember me") - submit = SubmitField("Sign in") diff --git a/login/kratos.py b/login/kratos.py deleted file mode 100644 index fe1678503e203cc0f1199f55a514b1b13af3af76..0000000000000000000000000000000000000000 --- a/login/kratos.py +++ /dev/null @@ -1,82 +0,0 @@ - - -import logging -from flask_login import UserMixin -class User(UserMixin): - def __init__(self, username): - - self.logger = logging.getLogger(__name__) - ch = logging.StreamHandler() - self.logger.addHandler(ch) - self.logger.setLevel(logging.DEBUG) - - self.id = username - self.username = username - - self.logger.info("User is trying to login: " + username) - - # TODO Make sure it's a username? - - return None - - - - def authenticate(self, password): - self.logger.info("User is providing password: " + password) - - # TODO: Accept all password, yeah! - return True - - - def get_oauth_session(self): - """Create openID Connect token - - Use the userdata stored in the user object to create an OpenID Connect token. - The token will be passed to Hydra, which will store it and serve it to all OpenID Connect - Clients, that successfully query the /userinfo endpoint. Every field in the "id_token" - dictionary can be accessed through standard scopes and claims. - See https://openid.net/specs/openid-connect-core-1_0.html#Claims - - Returns: - OpenID Connect token of type dict - """ - return { - "id_token": { - "name": self.username, - "preferred_username": self.username, - "email" : self.username + "@domain.com", - "openappstack_roles": ""} - } - - - - -class KratosError(Exception): - """Raised when requests to the backend server fail - - Attributes: - code -- http response code - headers -- http response headers - reason -- reson for the error - """ - def __init__(self, code, headers, reason): - self.code = code - self.headers = headers - self.reason = reason - - - -# raise KratosError( -# 1, -# 2, -# ("Error during retrieval of userdata - " )) -# -# self.active = False -# try: -# self._load_remote_user_info() -# except urllib.error.HTTPError as error: -# raise KratosError( -# error.code, -# error.headers, -# ("Error during retrieval of userdata - " + error.reason)) - diff --git a/login/models.py b/login/models.py index 1630fe77f6d4d5cbe6950d86dcd440f87bbdc68e..3bc8f2657139f0428e8e6d30471fe6644363df41 100644 --- a/login/models.py +++ b/login/models.py @@ -6,7 +6,7 @@ from sqlalchemy.orm import relationship from sqlalchemy import Column, Integer, String, ForeignKey, Boolean - +# User model class User(db.Model): __tablename__ = 'users' @@ -21,7 +21,7 @@ class User(db.Model): return '<id {}>'.format(self.id) - +# App model class App(db.Model): __tablename__ = 'apps' @@ -33,6 +33,7 @@ class App(db.Model): return '<id {}>'.format(self.id) +# App role class AppRole(db.Model): __tablename__ = 'user_app_roles' diff --git a/login/static/.gitkeep b/login/static/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391