mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 03:09:58 +00:00
Commented out keycloak
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from authlib.integrations.flask_client import OAuth
|
|
||||||
|
# from authlib.integrations.flask_client import OAuth
|
||||||
|
|
||||||
# Web Server
|
# Web Server
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -16,8 +17,10 @@ db = SQLAlchemy(app)
|
|||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
|
|
||||||
# Keycloak
|
# Keycloak
|
||||||
|
"""
|
||||||
oauth = OAuth(app=app)
|
oauth = OAuth(app=app)
|
||||||
url = "http://192.168.69.1:8180"
|
url = "http://192.168.69.1:8180"
|
||||||
|
|
||||||
keycloak: ... = oauth.register(
|
keycloak: ... = oauth.register(
|
||||||
name="keycloak",
|
name="keycloak",
|
||||||
client_id="ProjectIOT",
|
client_id="ProjectIOT",
|
||||||
@@ -36,3 +39,4 @@ keycloak: ... = oauth.register(
|
|||||||
"{url}/realms/ProjectIOT/.well-known/openid-configuration"
|
"{url}/realms/ProjectIOT/.well-known/openid-configuration"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
"""
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from flask import Blueprint, session, redirect, url_for, render_template
|
from flask import Blueprint, session, redirect, url_for, render_template
|
||||||
from application import keycloak
|
|
||||||
|
# from application import keycloak
|
||||||
|
|
||||||
auth_blueprint = Blueprint("auth", __name__, template_folder="templates")
|
auth_blueprint = Blueprint("auth", __name__, template_folder="templates")
|
||||||
|
|
||||||
@@ -17,14 +18,17 @@ def home():
|
|||||||
return redirect(url_for("auth.login"))
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
@auth_blueprint.route("/login")
|
@auth_blueprint.route("/login")
|
||||||
def login():
|
def login():
|
||||||
redirect_uri = url_for("auth.auth", _external=True)
|
redirect_uri = url_for("auth.auth", _external=True)
|
||||||
return keycloak.authorize_redirect(redirect_uri)
|
return keycloak.authorize_redirect(redirect_uri)
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
@auth_blueprint.route("/auth")
|
@auth_blueprint.route("/auth")
|
||||||
def auth():
|
def auth():
|
||||||
user = keycloak.userinfo()
|
user = keycloak.userinfo()
|
||||||
session["user"] = user
|
session["user"] = user
|
||||||
return redirect(url_for("auth.home"))
|
return redirect(url_for("auth.home"))
|
||||||
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user