Git Product home page Git Product logo

vapor-oauth's People

Contributors

0xtim avatar alexandre-pod avatar brett-best avatar marius-se avatar theswiftycoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vapor-oauth's Issues

Client secret is always required if set on client

I'm creating (with the new Fluent extensions) some OAuth clients with a Vapor controller and a POST request. Ideally, this POST request should allow a super user to create as many clients he'd like with different (and possibly multiple) grant types.
There could be situations with multiple grant types wher some flow would require, as per OAuth2 specifications, the presence of a client_secret. However, other don't. An example could be a single OAuth client with password + client_credentials grant types (I don't even know if it would make practical sense anyway, but there may be cases). The presence of a client_secret would require each REST call to the oauth endpoints (with any grant type) to provide it, otherwise the authenticateClient function here will raise an exception and throw out an error.
Does it make sense?

Documentation: OAuthHelper not described

Hi @0xTim and @marius-se,

This doesn't work:
.package(url: "https://github.com/brokenhandsio/vapor-oauth.git", branch: "1.0.0-beta.2")

try addProvider(VaporOAuth.Provider(codeManager: MyCodeManager(), tokenManager: MyTokenManager(), clientRetriever: MyClientRetriever(), authorizeHandler: MyAuthHandler(), userManager: MyUserManager(), validScopes: ["view_profile", "edit_profile"], resourceServerRetriever: MyResourceServerRetriever()))

This works:

app.lifecycle.use(
        OAuth2(
            codeManager: LiveCodeManger(),
            tokenManager: tokenManager,
            clientRetriever: StaticClientRetriever(clients: [someOAuthClient]),
            authorizeHandler: LiveAuthorizeHandler(),
            validScopes: ["admin"],
            //resourceServerRetriever: LiveResourceServerRetriever(),
            oAuthHelper: .local(
                tokenAuthenticator: TokenAuthenticator(),
                userManager: nil,
                tokenManager: tokenManager
            )

        )
    )

But oAuthHelper is not even mentioned in the documentation.

Test failure

I’m seeing TokenRefreshTests.testErrorWhenRequestingScopeWithNoScopesOriginallyRequestedOnRefreshToken() fail when I run locally, I wasn’t able to exactly figure out why it was happening though.

It looks like at one point travis was used for CI here.

Failed test: testErrorWhenRequestingScopeWithNoScopesOriginallyRequestedOnRefreshToken()

Test Suite 'Selected tests' started at 2023-12-09 15:51:36.975.
Test Suite 'VaporOAuthTests.xctest' started at 2023-12-09 15:51:36.975.
Test Suite 'TokenRefreshTests' started at 2023-12-09 15:51:36.975.
Test Case '-[VaporOAuthTests.TokenRefreshTests testErrorWhenRequestingScopeWithNoScopesOriginallyRequestedOnRefreshToken]' started.
2023-12-09T15:51:36+0100 info codes.vapor.request : request-id=50A454E1-AC5F-4652-ADD3-6247500FA98B [Vapor] POST /oauth/token/
/Users/kaeru/Library/Developer/Xcode/DerivedData/vapor-oauth-1.0.0-beta-ggpiumsqobyrmhfxbjcudwdlrdvz/SourcePackages/checkouts/swift-nio/Sources/NIOFoundationCompat/Codable+ByteBuffer.swift:34: error: -[VaporOAuthTests.TokenRefreshTests testErrorWhenRequestingScopeWithNoScopesOriginallyRequestedOnRefreshToken] : failed: caught error: "keyNotFound(CodingKeys(stringValue: "error", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"error\", intValue: nil) (\"error\").", underlyingError: nil))"
Test Case '-[VaporOAuthTests.TokenRefreshTests testErrorWhenRequestingScopeWithNoScopesOriginallyRequestedOnRefreshToken]' failed (0.356 seconds).
Test Suite 'TokenRefreshTests' failed at 2023-12-09 15:51:37.331.
	 Executed 1 test, with 1 failure (1 unexpected) in 0.356 (0.356) seconds
Test Suite 'VaporOAuthTests.xctest' failed at 2023-12-09 15:51:37.331.
	 Executed 1 test, with 1 failure (1 unexpected) in 0.356 (0.356) seconds
Test Suite 'Selected tests' failed at 2023-12-09 15:51:37.332.
	 Executed 1 test, with 1 failure (1 unexpected) in 0.356 (0.357) seconds
Program ended with exit code: 1

Compilation fatal error / VaporOAuth/RouteHandlers/AuthorizeGetHandler

222.7 [951/952] Compiling Vapor Application.swift
222.7 /build/.build/checkouts/vapor/Sources/Vapor/Request/Request.swift:5:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'RoutingKit'
222.7 import RoutingKit
222.7 ^
222.7 @preconcurrency 
222.7 /build/.build/checkouts/vapor/Sources/Vapor/Routing/Route.swift:2:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'RoutingKit'
222.7 import RoutingKit
222.7 ^
222.7 @preconcurrency 
223.8 [953/956] Compiling VaporOAuth EmptyAuthorizationHandler.swift
223.8 /build/.build/checkouts/vapor-oauth/Sources/VaporOAuth/RouteHandlers/AuthorizeGetHandler.swift:55:22: error: cannot find 'SecRandomCopyBytes' in scope
223.8         let status = SecRandomCopyBytes(kSecRandomDefault, 32, &bytes)
223.8                      ^~~~~~~~~~~~~~~~~~
223.8 /build/.build/checkouts/vapor-oauth/Sources/VaporOAuth/RouteHandlers/AuthorizeGetHandler.swift:55:41: error: cannot find 'kSecRandomDefault' in scope
223.8         let status = SecRandomCopyBytes(kSecRandomDefault, 32, &bytes)
223.8                                         ^~~~~~~~~~~~~~~~~
223.8 /build/.build/checkouts/vapor-oauth/Sources/VaporOAuth/RouteHandlers/AuthorizeGetHandler.swift:57:25: error: cannot find 'errSecSuccess' in scope
223.8         guard status == errSecSuccess else {
223.8                         ^~~~~~~~~~~~~
223.8 error: fatalError
223.8 /build/.build/checkouts/fluent/Sources/Fluent/Fluent+Sessions.swift:4:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'FluentKit'
223.8 import FluentKit
223.8 ^
223.8 @preconcurrency 
------
failed to solve: process "/bin/sh -c swift build -c release" did not complete successfully: exit code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.