mirror of
https://github.com/nikdoof/simple-webfinger.git
synced 2025-12-13 18:32:15 +00:00
Initial commit
This commit is contained in:
27
app.py
Normal file
27
app.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from flask import Flask, request, abort
|
||||
import yaml
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
with open('config.yaml', 'rb') as fobj:
|
||||
data = yaml.load(fobj, yaml.SafeLoader)
|
||||
|
||||
|
||||
@app.route("/.well-known/webfinger")
|
||||
def webfinger():
|
||||
resource = request.args.get('resource')
|
||||
|
||||
if resource.split('@')[1] != data['domain']:
|
||||
abort(404)
|
||||
|
||||
return {
|
||||
'subject': resource,
|
||||
'links': [{
|
||||
'rel': "http://openid.net/specs/connect/1.0/issuer",
|
||||
'href': data['oidc_href'],
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
Reference in New Issue
Block a user