Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 130
    • Issues 130
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 26
    • Merge Requests 26
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Registry
    • Registry
  • Packages
    • Packages
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !118

Merged
Opened 2 months ago by Brian Hatchet@brianhatchet:speech_balloon:
  • Report abuse
Report abuse

Checkout oauth

Backend for oauth

Sets up a redirect that refers users to /checkout with a session token

Sets up a new implicit grant in oauth. If the session token is set, it will issue a implicit grant and jwt for the logged in user

Added an api that writes sendwyre user accounts to a cassandra table that uses the user's guid as a primary key.

We'll need to set the "checkout_url" to the base hostname of the checkout site.

#261 (closed)

Edited 2 months ago by Brian Hatchet
Request to merge brianhatchet:checkout-oauth into master
  • Email patches
  • Plain diff
Pipeline #62974114 passed for 0f61a658 on brianhatchet:checkout-oauth
      No approval required
      Mark Harding
      Mark Harding

      Merged by Mark Harding 3 hours ago

      The changes were merged into master with c710bdef

      The source branch has been deleted

      Mentions #261 (closed)

      Pipeline #62975238 passed for c710bdef on master
            • Discussion 8
            • Commits 14
            • Pipelines 11
            • Changes 20
            0/4 discussions resolved
            • Loading...
            • Brian Hatchet :speech_balloon: @brianhatchet changed milestone to %sprint: Wire 2 months ago

              changed milestone to %sprint: Wire

            • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 2 months ago

              added 1 commit

              • 9c431b2b - CORS enabled

              Compare with previous version

            • Brian Hatchet :speech_balloon: @brianhatchet changed the description 2 months ago

              changed the description

            • Mark Harding
              Mark Harding @markeharding started a discussion on an old version of the diff 2 months ago
              Last updated by Brian Hatchet 2 months ago
              Controllers/api/api.php
              37 38 * )
              38 39 * @SWG\Info(title="Minds Public API", version="1.0")
              39 40 */
              41
              40 42 namespace Minds\Controllers\api;
              41 43
              42 use Minds\Core;
              43 44 use Minds\Interfaces;
              44 45 use Minds\Api\Factory;
              45 46
              46 47 class api implements Interfaces\Api
              47 48 {
              48
              49 /** @var Request $request **/
              49 /** @var Request $request * */
              • Mark Harding
                Mark Harding @markeharding · 2 months ago
                Owner

                Can we remove the last */ ?

              • Brian Hatchet
                Brian Hatchet :speech_balloon: @brianhatchet · 2 months ago
                Maintainer

                Removed

              • Brian Hatchet :speech_balloon: @brianhatchet changed this line in version 4 of the diff 2 months ago

                changed this line in version 4 of the diff

              Please register or sign in to reply
            • Mark Harding
              Mark Harding @markeharding started a discussion on an old version of the diff 2 months ago
              Last updated by Brian Hatchet 2 months ago
              Controllers/checkout.php
              9 use Minds\Common\Cookie;
              10
              11 class checkout implements Interfaces\Api
              12 {
              13 public function get($pages)
              14 {
              15 $checkoutKey = ['checkout_key' => base64_encode(openssl_random_pseudo_bytes(8))];
              16 $cookie = new Cookie();
              17 $cookie
              18 ->setName('checkout_key')
              19 ->setValue($checkoutKey['checkout_key'])
              20 ->setExpire(time() + 300)
              21 ->setPath('/')
              22 ->setHttpOnly(true)
              23 ->create();
              24 forward(Di::_()->get('Config')->get('checkout_url').'/authorize?'.http_build_query($checkoutKey));
              • Mark Harding
                Mark Harding @markeharding · 2 months ago
                Owner

                This is deprecate and replace with Core\page::forward

              • Brian Hatchet
                Brian Hatchet :speech_balloon: @brianhatchet · 2 months ago
                Maintainer

                I'll change the reference, but does the rest of our app know that? All the other references to forward (except for the one in Page) seem to point back to elgglib.php

                Also they are the exact same function https://gitlab.com/minds/engine/blob/master/Core/page.php#L80

                https://gitlab.com/minds/engine/blob/master/lib/elgglib.php#L116

                But I am assuming it's because of the comments at the top about moving them to tighter-scoped packages

              • Brian Hatchet :speech_balloon: @brianhatchet changed this line in version 4 of the diff 2 months ago

                changed this line in version 4 of the diff

              Please register or sign in to reply
            • Brian Hatchet :speech_balloon: @brianhatchet closed 2 months ago

              closed

            • Mark Harding
              Mark Harding @markeharding started a discussion on the diff 2 months ago
              Last updated by Brian Hatchet 2 months ago
              Core/OAuth/Repositories/ClientRepository.php
              28 * TODO: Implement clients for 3rd party apps.
              30 29 */
              31 30 public function getClientEntity($clientIdentifier, $grantType = null, $clientSecret = null, $mustValidateSecret = true)
              32 31 {
              33 32 $clients = [
              34 33 'mobile' => [
              35 'secret' => $this->config->get('oauth')['clients']['mobile']['secret'],
              36 'name' => 'Mobile',
              37 'redirect_uri' => '',
              34 'secret' => $this->config->get('oauth')['clients']['mobile']['secret'],
              35 'name' => 'Mobile',
              36 'redirect_uri' => '',
              38 37 'is_confidential' => $grantType === 'password' || $grantType === 'refresh_token' ? false : true,
              39 38 ],
              39 'checkout' => [
              40 'redirect_uri' => $this->config->get('checkout_url'),
              • Mark Harding
                Mark Harding @markeharding · 2 months ago
                Owner

                Does this require any of the above (mobile) fields? What about is_confidential=false?

              • Brian Hatchet
                Brian Hatchet :speech_balloon: @brianhatchet · 2 months ago
                Maintainer

                That's a nope.

                League's implicit grant hard codes a false in the getClientEntity. That only looks necessary for client authorization where we provide a secret (versus client using it to validate tokens)

                 $client = $this->clientRepository->getClientEntity(
                            $clientId,
                            $this->getIdentifier(),
                            null,
                            false
                        );
              Please register or sign in to reply
            • Mark Harding
              Mark Harding @markeharding started a discussion on an old version of the diff 2 months ago
              Last updated by Brian Hatchet 1 month ago
              Core/Router.php
              47 47 */
              48 48 public function route($uri = null, $method = null)
              49 49 {
              50 error_log('Route');
              • Mark Harding
                Mark Harding @markeharding · 2 months ago
                Owner

                can we cleanup the logs?

              • Brian Hatchet
                Brian Hatchet :speech_balloon: @brianhatchet · 2 months ago
                Maintainer

                Sorry, thought I got them all. There were alot more as I debugged cors :)

              • Brian Hatchet :speech_balloon: @brianhatchet changed this line in version 7 of the diff 1 month ago

                changed this line in version 7 of the diff

              Please register or sign in to reply
            • Brian Hatchet :speech_balloon: @brianhatchet reopened 2 months ago

              reopened

            • Brian Hatchet :speech_balloon: @brianhatchet added 9 commits 2 months ago

              added 9 commits

              • 9c431b2b...fe328ecf - 7 commits from branch minds:master
              • a2942119 - Merge branch 'master' of gitlab.com:minds/engine into checkout-oauth
              • 84a7e0ac - CR changes

              Compare with previous version

            • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 2 months ago

              added 1 commit

              • f0eb961b - Adding trailing slash

              Compare with previous version

            • Brian Hatchet :speech_balloon: @brianhatchet added 3 commits 1 month ago

              added 3 commits

              • f0344e11 - 1 commit from branch minds:master
              • 18a4d0cc - Merge remote-tracking branch 'upstream/master' into checkout-oauth
              • 21cc7267 - Fixing a slash a missed in the refactor

              Compare with previous version

            • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 month ago

              added 1 commit

              • d76e94ff - Removing stray logs

              Compare with previous version

            • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 month ago

              added 1 commit

              • 20dabd31 - Removing passing in the user's guid because we need to look up their account...

              Compare with previous version

            • Mark Harding @markeharding added 45 commits 1 month ago

              added 45 commits

              • 20dabd31...8bc2b151 - 44 commits from branch minds:master
              • 8dd5cd38 - Merge branch 'master' of gitlab.com:minds/engine into checkout-oauth

              Compare with previous version

            • Mark Harding @markeharding added 50 commits 4 weeks ago

              added 50 commits

              • 8dd5cd38...95b30fc7 - 49 commits from branch minds:master
              • 84604953 - Merge branch 'master' of gitlab.com:minds/engine into checkout-oauth

              Compare with previous version

            • Mark Harding @markeharding added 20 commits 3 hours ago

              added 20 commits

              • 84604953...56bb5682 - 18 commits from branch minds:master
              • d35518b9 - Merge branch 'master' of gitlab.com:minds/engine into checkout-oauth
              • 0f61a658 - (chore): add usd to checkout key

              Compare with previous version

            • Mark Harding @markeharding merged 3 hours ago

              merged

            • Mark Harding @markeharding mentioned in commit c710bdef 3 hours ago

              mentioned in commit c710bdef

            • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
            Please register or sign in to reply
            Assignee
            Brian Hatchet's avatar Brian Hatchet @brianhatchet
            Assign to
            sprint: Wire
            Milestone
            sprint: Wire
            Assign milestone
            None
            Time tracking
            No estimate or time spent
            0
            Labels
            None
            Assign labels
            • View project labels
            Lock merge request
            Unlocked
            2
            2 participants
            user avatar
            Brian Hatchet
            user avatar
            Mark Harding
            Reference: minds/engine!118

            Revert this merge request

            This will create a new commit in order to revert the existing changes.

            Switch branch
            Cancel
            A new branch will be created in your fork and a new merge request will be started.

            Cherry-pick this merge request

            Switch branch
            Cancel
            A new branch will be created in your fork and a new merge request will be started.