Skip to content

Commit

Permalink
Improve protocol handling in OAuth2 initialization (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsii777 authored Nov 11, 2024
1 parent cb71826 commit fcf7495
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Sources/VaporOAuth/OAuth2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public struct OAuth2: LifecycleHandler {
/// - oAuthHelper: Helper service for OAuth operations
/// - metadataProvider: Service for providing server metadata
public init(
codeManager: CodeManager = EmptyCodeManager(),
tokenManager: TokenManager,
deviceCodeManager: DeviceCodeManager = EmptyDeviceCodeManager(),
clientRetriever: ClientRetriever,
authorizeHandler: AuthorizeHandler = EmptyAuthorizationHandler(),
userManager: UserManager = EmptyUserManager(),
codeManager: any CodeManager = EmptyCodeManager(),
tokenManager: any TokenManager,
deviceCodeManager: any DeviceCodeManager = EmptyDeviceCodeManager(),
clientRetriever: any ClientRetriever,
authorizeHandler: any AuthorizeHandler = EmptyAuthorizationHandler(),
userManager: any UserManager = EmptyUserManager(),
validScopes: [String]? = nil,
resourceServerRetriever: any ResourceServerRetriever = EmptyResourceServerRetriever(),
oAuthHelper: OAuthHelper,
Expand Down
2 changes: 1 addition & 1 deletion Tests/VaporOAuthTests/Helpers/TestDataBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestDataBuilder {

app.lifecycle.use(
OAuth2(
issuer: issuer, codeManager: codeManager,
codeManager: codeManager,
tokenManager: tokenManager,
deviceCodeManager: deviceCodeManager,
clientRetriever: clientRetriever,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AuthCodeResourceServerTests: XCTestCase {
fakeUserManager.users.append(newUser)

let oauthProvider = OAuth2(
issuer: issuer, codeManager: fakeCodeManager,
codeManager: fakeCodeManager,
tokenManager: fakeTokenManager,
clientRetriever: clientRetriever,
authorizeHandler: capturingAuthouriseHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class MetadataEndpointTests: XCTestCase {

func testRequiredRFCFields() async throws {
let oauthProvider = OAuth2(
issuer: issuer,
jwksEndpoint: jwksEndpoint,
tokenManager: FakeTokenManager(),
clientRetriever: StaticClientRetriever(clients: []),
oAuthHelper: .local(
Expand Down Expand Up @@ -53,8 +51,6 @@ class MetadataEndpointTests: XCTestCase {
let validScopes = ["profile", "email"]

let oauthProvider = OAuth2(
issuer: issuer,
jwksEndpoint: jwksEndpoint,
codeManager: FakeCodeManager(),
tokenManager: FakeTokenManager(),
deviceCodeManager: FakeDeviceCodeManager(),
Expand Down Expand Up @@ -136,8 +132,6 @@ class MetadataEndpointTests: XCTestCase {
}

let oauthProvider = OAuth2(
issuer: issuer,
jwksEndpoint: jwksEndpoint,
tokenManager: FakeTokenManager(),
clientRetriever: StaticClientRetriever(clients: []),
oAuthHelper: .local(
Expand Down Expand Up @@ -184,8 +178,6 @@ class MetadataEndpointTests: XCTestCase {
// MARK: - Error Cases
func testMetadataEndpointRequiredHeaders() async throws {
let oauthProvider = OAuth2(
issuer: issuer,
jwksEndpoint: jwksEndpoint,
tokenManager: FakeTokenManager(),
clientRetriever: StaticClientRetriever(clients: []),
oAuthHelper: .local(
Expand Down

0 comments on commit fcf7495

Please sign in to comment.