-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
159 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script setup> | ||
import { ref } from 'vue' | ||
import { useAccessToken } from '@/utils/AccessToken.js' | ||
import { HTTPSecure } from '@/services' | ||
const accessToken = useAccessToken() | ||
// cannot call accessToken.get() if not defined this results in error... | ||
const headers = { Authorization: `Bearer ${accessToken.access_token}` } | ||
// there must be a nicer way to set the Authorization directly using the HTTPSecure config | ||
// does this overwrite the config? | ||
// passing headers with null token results in 422 'Not enough segments'... | ||
const user = ref() | ||
const testlogin = () => { | ||
HTTPSecure.get('/access/testlogin', { headers }) | ||
.then((response) => { | ||
user.value = response.data | ||
}) | ||
.catch((err) => { | ||
console.log(err.response.status) | ||
// on error what to do | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<DefaultLayout> | ||
<SectionLayout> | ||
<div class="flex"> | ||
<Button | ||
@click="testlogin()" | ||
type="button" | ||
size="small" | ||
icon="pi pi-eye" | ||
label="Check it!" | ||
/> | ||
</div> | ||
<div class="mt-4"> | ||
<p>USER IS : {{ user }}</p> | ||
</div> | ||
</SectionLayout> | ||
</DefaultLayout> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +0,0 @@ | ||
from flask import Blueprint | ||
|
||
api = Blueprint("api", __name__) | ||
|
||
# E402 module level import not at top of file | ||
from . import public | ||
from . import secure | ||
from . import authorisation | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
|
||
from flask import Blueprint, request, jsonify | ||
from flask_cors import cross_origin | ||
from flask_jwt_extended import jwt_required, get_jwt_identity | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
access_api = Blueprint("access_api", __name__) | ||
|
||
|
||
@access_api.route("/testlogin", methods=["GET"]) | ||
@cross_origin(supports_credentials=True) | ||
@jwt_required() | ||
def testlogin(): | ||
# Access the identity of the current user with get_jwt_identity | ||
current_user = get_jwt_identity() | ||
return jsonify(logged_in_as=current_user), 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import logging | ||
|
||
from flask import Blueprint, request, jsonify | ||
from flask_cors import cross_origin | ||
from flask_jwt_extended import jwt_required, get_jwt_identity | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
upload_api = Blueprint("upload_api", __name__) | ||
|
||
|
||
@upload_api.route("/upload", methods=["GET"]) | ||
@cross_origin(supports_credentials=True) | ||
@jwt_required() | ||
def secure_endpoint(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters