MCPcopy Create free account
hub / github.com/authlib/authlib / exists_nonce

Method exists_nonce

authlib/oidc/core/grants/code.py:131–145  ·  view source on GitHub ↗

Check if the given nonce is existing in your database. Developers MUST implement this method in subclass, e.g.:: def exists_nonce(self, nonce, request): exists = AuthorizationCode.query.filter_by( client_id=request.payload.client_id, nonce=non

(self, nonce, request)

Source from the content-addressed store, hash-verified

129 self.require_nonce = require_nonce
130
131 def exists_nonce(self, nonce, request):
132 """Check if the given nonce is existing in your database. Developers
133 MUST implement this method in subclass, e.g.::
134
135 def exists_nonce(self, nonce, request):
136 exists = AuthorizationCode.query.filter_by(
137 client_id=request.payload.client_id, nonce=nonce
138 ).first()
139 return bool(exists)
140
141 :param nonce: A string of "nonce" parameter in request
142 :param request: OAuth2Request instance
143 :return: Boolean
144 """
145 raise NotImplementedError()
146
147 def validate_openid_authorization_request(self, grant, redirect_uri):
148 validate_nonce(grant.request, self.exists_nonce, self.require_nonce)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected