-
Notifications
You must be signed in to change notification settings - Fork 27
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
Consolidate oauth2 provider type #194
Draft
WilliamBergamin
wants to merge
3
commits into
main
Choose a base branch
from
consolidate-Oauth2ProviderType
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
import { OAuth2ProviderTypeValues } from "../../schema/providers/oauth2/types.ts"; | ||
import { ManifestOAuth2ProviderSchema } from "../../manifest/manifest_schema.ts"; | ||
|
||
export type OAuth2ProviderIdentitySchema = { | ||
"url": string; | ||
"account_identifier": string; | ||
"headers"?: { | ||
[key: string]: string; | ||
}; | ||
export type OAuth2ProviderDefinitionArgs = ManifestOAuth2ProviderSchema & { | ||
/** A unique name for the provider */ | ||
provider_key: string; | ||
}; | ||
|
||
/** | ||
* TODO: The type system here could be improved one more then one provider type (CUSTOM) is available | ||
* provider_name, authorization_url, token_url, identity_config and authorization_url_extras | ||
* are only required for CUSTOM provider types | ||
*/ | ||
export type OAuth2ProviderOptions = { | ||
/** Client id for your provider */ | ||
"client_id": string; | ||
/** Scopes for your provider */ | ||
"scope": string[]; | ||
/** Display name for your provider. Required for CUSTOM provider types. */ | ||
"provider_name"?: string; | ||
/** Authorization url for your provider. Required for CUSTOM provider types. */ | ||
"authorization_url"?: string; | ||
/** Token url for your provider. Required for CUSTOM provider types. */ | ||
"token_url"?: string; | ||
/** Identity configuration for your provider. Required for CUSTOM provider types. */ | ||
"identity_config"?: OAuth2ProviderIdentitySchema; | ||
/** Client id for the provider */ | ||
client_id: string; | ||
/** Scopes for the provider */ | ||
scope: string[]; | ||
/** Display name for the provider. Required for CUSTOM provider types. */ | ||
provider_name?: string; | ||
/** Authorization url for the provider. Required for CUSTOM provider types. */ | ||
authorization_url?: string; | ||
/** Token url for the provider. Required for CUSTOM provider types. */ | ||
token_url?: string; | ||
/** Identity configuration for the provider. Required for CUSTOM provider types. */ | ||
identity_config?: OAuth2ProviderIdentity; | ||
/** Optional extras dict for authorization url for your provider. Required for CUSTOM provider types. */ | ||
"authorization_url_extras"?: { [key: string]: string }; | ||
authorization_url_extras?: { [key: string]: string }; | ||
}; | ||
|
||
export type OAuth2ProviderDefinitionArgs = { | ||
/** A unique name for your provider */ | ||
provider_key: string; | ||
/** Type of your provider */ | ||
provider_type: OAuth2ProviderTypeValues; | ||
/** OAuth2 Configuration options for your provider */ | ||
options: OAuth2ProviderOptions; | ||
export type OAuth2ProviderIdentity = { | ||
url: string; | ||
account_identifier: string; | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
}; |
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.
In theory these should be required but I fear that making these fields
required
might break some appsThere 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.
How did you determine that these fields are required? Checked the backend schema or some other way?
Can you confirm that not providing these fields works? I.e. can you deploy an app and pass manifest validation if you remove these fields?
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.
The comments for each of those field mentioned that they we required for
CUSTOM
provider types, I am assuming they are trueBut since those fields are currently
not required
I don't think we can make themrequired
without potentially breaking appsThere 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.
"Breaking" from a static-type-check perspective, that is true, however, if the backend requires these fields anyways, then that is much less a concern, I think, because no real app would be able to define a provider without them.
That's why I think we should test this out on a real app 😄