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

Update examples with HB2-beta.5 #80

Merged
merged 9 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--exclude .build

# rules
--disable redundantReturn, extensionAccessControl, unusedArguments
--disable redundantReturn, extensionAccessControl, unusedArguments, yodaconditions
adam-fowler marked this conversation as resolved.
Show resolved Hide resolved

# format options
--ifdef no-indent
Expand Down
12 changes: 6 additions & 6 deletions auth-cognito/Package.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "auth-cognito",
platforms: [.macOS(.v14)],
platforms: [
.macOS(.v14),
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.1"),
.package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-beta.1"),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.5"),
.package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-beta.2"),
.package(url: "https://github.com/adam-fowler/soto-cognito-authentication-kit.git", from: "5.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"),
],
targets: [
.executableTarget(
Expand Down
12 changes: 9 additions & 3 deletions auth-cognito/Sources/App/Application+build.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AsyncHTTPClient
import Hummingbird
import HummingbirdAuth
import HummingbirdRouter
Expand All @@ -14,9 +15,11 @@ struct AWSClientService: Service {
}
}

func buildApplication(configuration: ApplicationConfiguration) async throws -> some ApplicationProtocol {
func buildApplication(
configuration: ApplicationConfiguration
) async throws -> some ApplicationProtocol {
// setup Soto
let awsClient = AWSClient(httpClientProvider: .createNew)
let awsClient = AWSClient(httpClient: HTTPClient.shared)
let cognitoIdentityProvider = CognitoIdentityProvider(client: awsClient, region: .euwest1)
// setup SotoCognitoAuthentication
let env = try await Environment().merging(with: .dotEnv())
Expand All @@ -36,7 +39,10 @@ func buildApplication(configuration: ApplicationConfiguration) async throws -> s

let router = RouterBuilder(context: AuthCognitoRequestContext.self) {
AWSErrorMiddleware()
UserController(cognitoAuthenticatable: authenticatable, cognitoIdentityProvider: cognitoIdentityProvider).endpoints
UserController(
cognitoAuthenticatable: authenticatable,
cognitoIdentityProvider: cognitoIdentityProvider
).endpoints
}

var app = Application(router: router)
Expand Down
Loading
Loading