Skip to content
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

Add public initializer to OAuthServerMetadata #17

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Sources/VaporOAuth/Models/OAuthServerMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,60 @@ public struct OAuthServerMetadata: Content, Sendable {
/// The endpoint used for the OAuth 2.0 Device Authorization Grant flow.
let deviceAuthorizationEndpoint: String?

public init(
issuer: String,
authorizationEndpoint: String,
tokenEndpoint: String,
jwksUri: String,
responseTypesSupported: [String],
subjectTypesSupported: [String],
idTokenSigningAlgValuesSupported: [String],
scopesSupported: [String]? = nil,
tokenEndpointAuthMethodsSupported: [String]? = nil,
grantTypesSupported: [String]? = nil,
userinfoEndpoint: String? = nil,
registrationEndpoint: String? = nil,
claimsSupported: [String]? = nil,
tokenIntrospectionEndpoint: String? = nil,
tokenRevocationEndpoint: String? = nil,
serviceDocumentation: String? = nil,
uiLocalesSupported: [String]? = nil,
opPolicyUri: String? = nil,
opTosUri: String? = nil,
revocationEndpointAuthMethodsSupported: [String]? = nil,
revocationEndpointAuthSigningAlgValuesSupported: [String]? = nil,
introspectionEndpointAuthMethodsSupported: [String]? = nil,
introspectionEndpointAuthSigningAlgValuesSupported: [String]? = nil,
codeChallengeMethodsSupported: [String]? = nil,
deviceAuthorizationEndpoint: String? = nil
) {
self.issuer = issuer
self.authorizationEndpoint = authorizationEndpoint
self.tokenEndpoint = tokenEndpoint
self.jwksUri = jwksUri
self.responseTypesSupported = responseTypesSupported
self.subjectTypesSupported = subjectTypesSupported
self.idTokenSigningAlgValuesSupported = idTokenSigningAlgValuesSupported
self.scopesSupported = scopesSupported
self.tokenEndpointAuthMethodsSupported = tokenEndpointAuthMethodsSupported
self.grantTypesSupported = grantTypesSupported
self.userinfoEndpoint = userinfoEndpoint
self.registrationEndpoint = registrationEndpoint
self.claimsSupported = claimsSupported
self.tokenIntrospectionEndpoint = tokenIntrospectionEndpoint
self.tokenRevocationEndpoint = tokenRevocationEndpoint
self.serviceDocumentation = serviceDocumentation
self.uiLocalesSupported = uiLocalesSupported
self.opPolicyUri = opPolicyUri
self.opTosUri = opTosUri
self.revocationEndpointAuthMethodsSupported = revocationEndpointAuthMethodsSupported
self.revocationEndpointAuthSigningAlgValuesSupported = revocationEndpointAuthSigningAlgValuesSupported
self.introspectionEndpointAuthMethodsSupported = introspectionEndpointAuthMethodsSupported
self.introspectionEndpointAuthSigningAlgValuesSupported = introspectionEndpointAuthSigningAlgValuesSupported
self.codeChallengeMethodsSupported = codeChallengeMethodsSupported
self.deviceAuthorizationEndpoint = deviceAuthorizationEndpoint
}

enum CodingKeys: String, CodingKey {
case issuer
case authorizationEndpoint = "authorization_endpoint"
Expand Down
Loading