-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OAuth2 AuthZ Server Metadata example
- Loading branch information
1 parent
f77b41f
commit 454a376
Showing
1 changed file
with
25 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import bottle | ||
from bottle_oauthlib.oauth2 import BottleOAuth2 | ||
from oauthlib import oauth2 | ||
|
||
app = bottle.Bottle() | ||
app.auth = BottleOAuth2(app) | ||
app.authmetadata = BottleOAuth2(app) | ||
|
||
oauthlib_server = oauth2.LegacyApplicationServer(oauth2.RequestValidator()) | ||
app.authmetadata.initialize(oauth2.MetadataEndpoint([oauthlib_server], claims={ | ||
"issuer": "https://xx", | ||
"token_endpoint": "https://xx/token", | ||
"revocation_endpoint": "https://xx/revoke", | ||
"introspection_endpoint": "https://xx/tokeninfo" | ||
})) | ||
|
||
|
||
@app.get('/.well-known/oauth-authorization-server') | ||
@app.authmetadata.create_metadata_response() | ||
def metadata(): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run() # pragma: no cover |