-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ridi/feature/multi-key
무중단 키 변경을 위해 다수의 키로 시도 할 수 있도록 변경
- Loading branch information
Showing
13 changed files
with
99 additions
and
28 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
language: python | ||
python: | ||
- '3.6' | ||
dist: xenial | ||
|
||
stages: | ||
- test | ||
|
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
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
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
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
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 |
---|---|---|
@@ -1,14 +1,29 @@ | ||
from typing import Dict | ||
|
||
import jwt | ||
|
||
from ridi_oauth2.introspector.dtos import AccessTokenInfo, JwtInfo | ||
from ridi_oauth2.introspector.exceptions import InvalidJwtSignatureException | ||
from ridi_oauth2.introspector.jwt_introspector import JwtIntrospector | ||
|
||
|
||
class JwtIntrospectHelper: | ||
@staticmethod | ||
def introspect(jwt_info: JwtInfo, access_token: str) -> AccessTokenInfo: | ||
def introspect(jwt_infos: Dict[str, JwtInfo], access_token: str) -> AccessTokenInfo: | ||
unverified_header = jwt.get_unverified_header(access_token) | ||
kid = unverified_header.get('kid') | ||
if not kid: | ||
raise InvalidJwtSignatureException | ||
|
||
jwt_info = jwt_infos.get(kid) | ||
if not jwt_info: | ||
raise InvalidJwtSignatureException | ||
|
||
introspector = JwtIntrospector(jwt_info=jwt_info, access_token=access_token) | ||
result = introspector.introspect() | ||
|
||
try: | ||
return AccessTokenInfo.from_dict(result) | ||
|
||
except KeyError: | ||
raise InvalidJwtSignatureException |
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
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
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
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
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
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
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