Implemented the Auth middleware (#3)

This PR contains the work done to implement the `AuthMiddleware` middleware that, when plugged into a `Client` object, adds authentication parameters to any request the client would make.

Reviewed-on: #3
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #3.
This commit is contained in:
2025-10-04 10:57:15 +00:00
committed by Javier Cicchelli
parent 7006aa1bc8
commit ce0ec02c03
10 changed files with 599 additions and 0 deletions
@@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===
//
// This source file is part of the MarvelService open source project
//
// Copyright (c) 2025 Röck+Cöde VoF. and the MarvelService project authors
// Licensed under the EUPL 1.2 or later.
//
// See LICENSE for license information
// See CONTRIBUTORS for the list of MarvelService project authors
//
//===----------------------------------------------------------------------===
extension String {
/// A namespace assigned for Marvel API key samples.
enum Key {
/// A Marvel API private key sample.
static let `private` = "SomePrivateKey"
/// A Marvel API public key sample.
static let `public` = "SomePublicKey"
}
}
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===
//
// This source file is part of the MarvelService open source project
//
// Copyright (c) 2025 Röck+Cöde VoF. and the MarvelService project authors
// Licensed under the EUPL 1.2 or later.
//
// See LICENSE for license information
// See CONTRIBUTORS for the list of MarvelService project authors
//
//===----------------------------------------------------------------------===
import Testing
extension Tag {
// MARK: Constants
/// A flag that indicates tests for a type extension.
@Tag static var `extension`: Self
/// A flag that indicates tests for a middleware type.
@Tag static var middleware: Self
/// A flag that indicates tests for a use case type.
@Tag static var useCase: Self
}
@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===
//
// This source file is part of the MarvelService open source project
//
// Copyright (c) 2025 Röck+Cöde VoF. and the MarvelService project authors
// Licensed under the EUPL 1.2 or later.
//
// See LICENSE for license information
// See CONTRIBUTORS for the list of MarvelService project authors
//
//===----------------------------------------------------------------------===
import struct Foundation.Date
import struct Foundation.TimeInterval
/// A namespace assigned for input arguments on test cases.
enum Input {
// MARK: Constants
/// A list of timestamps samples.
static let timestamps: [TimeInterval] = [
Date(timeIntervalSince1970: 0).timeIntervalSince1970,
Date(timeIntervalSince1970: 1_000).timeIntervalSince1970,
Date(timeIntervalSince1970: 1_000_000).timeIntervalSince1970,
Date(timeIntervalSince1970: 1_000_000_000).timeIntervalSince1970,
]
}
@@ -0,0 +1,14 @@
//===----------------------------------------------------------------------===
//
// This source file is part of the MarvelService open source project
//
// Copyright (c) 2025 Röck+Cöde VoF. and the MarvelService project authors
// Licensed under the EUPL 1.2 or later.
//
// See LICENSE for license information
// See CONTRIBUTORS for the list of MarvelService project authors
//
//===----------------------------------------------------------------------===
/// A namespace assigned for output arguments on test cases, that are expected results.
enum Output {}