Skip to content
Snippets Groups Projects

Checkout oauth

Merged Brian Hatchet requested to merge brianhatchet/engine:checkout-oauth into master
4 unresolved threads

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 by Brian Hatchet

Merge request reports

Pipeline #62974114 passed

Pipeline passed for 0f61a658 on brianhatchet:checkout-oauth

Merged by Mark HardingMark Harding 5 years ago (May 24, 2019 10:07am UTC)

Loading

Pipeline #62975238 passed

Pipeline passed for c710bdef on master

Deployed to run‎ners‎ 4 years ago

Loading deployment statistics

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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 * */
  • 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));
  • closed

  • 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'),
    • Does this require any of the above (mobile) fields? What about is_confidential=false?

    • 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
  • 47 47 */
    48 48 public function route($uri = null, $method = null)
    49 49 {
    50 error_log('Route');
  • reopened

  • Brian Hatchet added 9 commits

    added 9 commits

    Compare with previous version

  • Brian Hatchet added 1 commit

    added 1 commit

    Compare with previous version

  • Brian Hatchet added 3 commits

    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 added 1 commit

    added 1 commit

    Compare with previous version

  • Brian Hatchet added 1 commit

    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 added 45 commits

    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 added 50 commits

    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 added 20 commits

    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

  • merged

  • Mark Harding mentioned in commit c710bdef

    mentioned in commit c710bdef

  • Please register or sign in to reply
    Loading