Skip to content

Commit 1a2ab22

Browse files
coenttbclaude
andcommitted
Initial implementation of RFC 6750 OAuth 2.0 Bearer Token Usage
- Complete Bearer token implementation with validation - Three transmission methods: Authorization header, form parameter, URI query - WWW-Authenticate challenge support with realm, scope, error parameters - Standard OAuth 2.0 error codes and comprehensive error handling - Full test coverage with 19 passing tests - Follows RFC 6750 specification requirements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
0 parents  commit 1a2ab22

File tree

8 files changed

+710
-0
lines changed

8 files changed

+710
-0
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: macos-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Swift
17+
uses: swift-actions/setup-swift@v2
18+
with:
19+
swift-version: "6.0"
20+
21+
- name: Build
22+
run: swift build
23+
24+
- name: Run tests
25+
run: swift test
26+
27+
- name: Check Swift format
28+
run: |
29+
if command -v swiftformat >/dev/null 2>&1; then
30+
swiftformat --lint .
31+
else
32+
echo "swiftformat not installed, skipping format check"
33+
fi

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Swift Package Manager
2+
.build/
3+
.swiftpm/
4+
Package.resolved
5+
6+
# Xcode
7+
*.xcodeproj/
8+
*.xcworkspace/
9+
xcuserdata/
10+
DerivedData/
11+
*.hmap
12+
*.ipa
13+
*.dSYM.zip
14+
*.dSYM
15+
16+
# macOS
17+
.DS_Store
18+
19+
# AI tools
20+
CLAUDE.md
21+
.claude
22+
.cursor/
23+
.aider*
24+
25+
# IDE
26+
.vscode/
27+
.idea/
28+
29+
# Temporary files
30+
*.tmp
31+
*.swp
32+
*~

.swiftlint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
disabled_rules:
2+
- trailing_whitespace
3+
- line_length
4+
5+
opt_in_rules:
6+
- empty_count
7+
- file_header
8+
9+
included:
10+
- Sources
11+
- Tests
12+
13+
excluded:
14+
- .build
15+
- .swiftpm
16+
17+
file_header:
18+
required_pattern: |
19+
\/\/
20+
\/\/ .*\.swift
21+
\/\/ swift-rfc-.*
22+
\/\/
23+
\/\/ Created by .* on .*\.
24+
\/\/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Swift Web Standards
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// swift-tools-version:6.0
2+
3+
import Foundation
4+
import PackageDescription
5+
6+
extension String {
7+
static let rfc6750: Self = "RFC_6750"
8+
}
9+
10+
extension Target.Dependency {
11+
static var rfc6750: Self { .target(name: .rfc6750) }
12+
}
13+
14+
let package = Package(
15+
name: "swift-rfc-6750",
16+
platforms: [
17+
.macOS(.v13),
18+
.iOS(.v16)
19+
],
20+
products: [
21+
.library(name: .rfc6750, targets: [.rfc6750]),
22+
],
23+
dependencies: [
24+
// Add RFC dependencies here as needed
25+
// .package(url: "https://github.com/swift-web-standards/swift-rfc-1123.git", branch: "main"),
26+
],
27+
targets: [
28+
.target(
29+
name: .rfc6750,
30+
dependencies: [
31+
// Add target dependencies here
32+
]
33+
),
34+
.testTarget(
35+
name: .rfc6750.tests,
36+
dependencies: [
37+
.rfc6750
38+
]
39+
),
40+
],
41+
swiftLanguageModes: [.v6]
42+
)
43+
44+
extension String { var tests: Self { self + " Tests" } }

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# swift-rfc-6750
2+
3+
Swift implementation of [RFC 6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage](https://www.rfc-editor.org/rfc/rfc6750.html)
4+
5+
## Installation
6+
7+
### Swift Package Manager
8+
9+
Add this to your Package.swift:
10+
11+
```swift
12+
dependencies: [
13+
.package(url: "https://github.com/swift-web-standards/swift-rfc-6750.git", branch: "main")
14+
]
15+
```
16+
17+
## Usage
18+
19+
```swift
20+
import RFC_6750
21+
22+
// TODO: Add usage examples
23+
```
24+
25+
## Documentation
26+
27+
For complete documentation of RFC 6750, see the [official RFC document](https://www.rfc-editor.org/rfc/rfc6750.html).
28+
29+
## License
30+
31+
This project is licensed under the MIT License - see the LICENSE file for details.

0 commit comments

Comments
 (0)