-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Refactoring code to get oidc end points from discovery URL. #4429
Merged
tokoko
merged 7 commits into
feast-dev:master
from
lokeshrangineni:feature/feast-oidc-discovery-url
Aug 24, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9536377
refactoring the permissions side server side code to get the OIDC end…
lokeshrangineni 4f6ff0a
refactoring the permissions side server side code to get the OIDC end…
lokeshrangineni a43bed0
Merge remote-tracking branch 'fork/feature/feast-oidc-discovery-url' …
lokeshrangineni 2e676fc
refactoring the permissions side server side code to get the OIDC end…
lokeshrangineni 96e7363
refactoring the permissions side server side code to get the OIDC end…
lokeshrangineni ba200ae
Merge remote-tracking branch 'fork/feature/feast-oidc-discovery-url' …
lokeshrangineni afd093a
Fixing the issue with pre-commit hook template. Accidentally this was…
lokeshrangineni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import requests | ||
|
||
|
||
class OIDCDiscoveryService: | ||
def __init__(self, discovery_url: str): | ||
self.discovery_url = discovery_url | ||
self._discovery_data = None # Initialize it lazily. | ||
|
||
@property | ||
def discovery_data(self): | ||
"""Lazily fetches and caches the OIDC discovery data.""" | ||
if self._discovery_data is None: | ||
self._discovery_data = self._fetch_discovery_data() | ||
return self._discovery_data | ||
|
||
def _fetch_discovery_data(self) -> dict: | ||
try: | ||
response = requests.get(self.discovery_url) | ||
response.raise_for_status() | ||
return response.json() | ||
except requests.RequestException as e: | ||
raise RuntimeError( | ||
f"Error fetching OIDC discovery response, discovery url - {self.discovery_url}, exception - {e} " | ||
) | ||
|
||
def get_authorization_url(self) -> str: | ||
"""Returns the authorization endpoint URL.""" | ||
return self.discovery_data.get("authorization_endpoint") | ||
|
||
def get_token_url(self) -> str: | ||
"""Returns the token endpoint URL.""" | ||
return self.discovery_data.get("token_endpoint") | ||
|
||
def get_jwks_url(self) -> str: | ||
"""Returns the jwks endpoint URL.""" | ||
return self.discovery_data.get("jwks_uri") | ||
|
||
def get_refresh_url(self) -> str: | ||
"""Returns the refresh token URL (usually same as token URL).""" | ||
return self.get_token_url() |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍