Skip to content

Commit

Permalink
Add OAuth2 AuthZ Server Metadata example
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHuot committed Jan 8, 2019
1 parent f77b41f commit 454a376
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/examples/metadata.py
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

0 comments on commit 454a376

Please sign in to comment.