mirror of
https://github.com/nikdoof/simple-webfinger.git
synced 2025-12-13 10:22:15 +00:00
28 lines
581 B
Python
28 lines
581 B
Python
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)
|