From 072a71503d8a4617a91743ea4c623e6237a9f4b5 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Wed, 10 Aug 2022 08:22:03 +1000 Subject: [PATCH] feat(#458): Add DruxtAuth to DruxtSite example (#547) * feat(#458): add auth modules and configuration * chore(#458): update example auth * chore(#458): add default docs .env * chore(#546): add druxt-site example message * chore(#438): add examples documentation --- .gitpod.yml | 5 +- .gitpod/WELCOME.md | 3 +- .gitpod/scripts/env-setup.sh | 4 + CONTRIBUTING.md | 34 + docs/.env | 1 + docs/drupal/.ddev/commands/web/drupal-install | 1 + docs/drupal/.ddev/commands/web/gitpod-config | 16 + docs/drupal/.ddev/docker-compose.env.yaml | 8 + docs/drupal/composer.json | 1 + docs/drupal/composer.lock | 728 +++++++++++++++++- docs/drupal/config/sync/core.extension.yml | 6 +- ...oauth.oauth2_token.bundle.access_token.yml | 10 + ...le_oauth.oauth2_token.bundle.auth_code.yml | 10 + ...auth.oauth2_token.bundle.refresh_token.yml | 10 + .../config/sync/simple_oauth.settings.yml | 11 + ....1a6b8816-26de-4b70-bcdf-919600542f03.json | 62 ++ docs/drupal/content/meta/index.json | 5 +- docs/drupal/keys/private.key | 52 ++ docs/drupal/keys/public.key | 14 + docs/drupal/web/sites/default/services.yml | 191 +++++ examples/druxt-site/nuxt.config.js | 11 +- examples/druxt-site/package.json | 1 + .../druxt-site/pages/_langcode/user/login.vue | 15 + examples/druxt-site/yarn.lock | 189 ++++- package.json | 1 + 25 files changed, 1378 insertions(+), 11 deletions(-) create mode 100755 .gitpod/scripts/env-setup.sh create mode 100644 docs/.env create mode 100755 docs/drupal/.ddev/commands/web/gitpod-config create mode 100644 docs/drupal/.ddev/docker-compose.env.yaml create mode 100644 docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.access_token.yml create mode 100644 docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.auth_code.yml create mode 100644 docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.refresh_token.yml create mode 100644 docs/drupal/config/sync/simple_oauth.settings.yml create mode 100644 docs/drupal/content/consumer.1a6b8816-26de-4b70-bcdf-919600542f03.json create mode 100644 docs/drupal/keys/private.key create mode 100644 docs/drupal/keys/public.key create mode 100644 docs/drupal/web/sites/default/services.yml create mode 100644 examples/druxt-site/pages/_langcode/user/login.vue diff --git a/.gitpod.yml b/.gitpod.yml index 4672810e0..a7d23d33c 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -19,8 +19,11 @@ tasks: cd $GITPOD_REPO_ROOT/docs/nuxt && yarn cd $GITPOD_REPO_ROOT && yarn build:docs command: | + # Setup Gitpod .env + $GITPOD_REPO_ROOT/.gitpod/scripts/env-setup.sh + # Start Drupal - cd $GITPOD_REPO_ROOT/docs/drupal && ddev start -y && ddev drush uli + cd $GITPOD_REPO_ROOT/docs/drupal && ddev start -y && ddev gitpod-config && ddev drush uli # Display welcome message cd $GITPOD_REPO_ROOT && cat .gitpod/WELCOME.md diff --git a/.gitpod/WELCOME.md b/.gitpod/WELCOME.md index 18b5424a8..44f794c4e 100644 --- a/.gitpod/WELCOME.md +++ b/.gitpod/WELCOME.md @@ -11,7 +11,8 @@ To get started you can do one of the following tasks: - Run the Druxt build tools: `yarn build --watch` - Run the Druxt test suite: `yarn test --watch` -- Generate Druxt documetation: `yarn build:docs` +- Generate Druxt documentation: `yarn build:docs` +- Start an example DruxtSite: `yarn example:druxt-site` - Start the DruxtJS.org website: `cd docs/nuxt && yarn dev` Happy contributing. diff --git a/.gitpod/scripts/env-setup.sh b/.gitpod/scripts/env-setup.sh new file mode 100755 index 000000000..9ecb4f3ad --- /dev/null +++ b/.gitpod/scripts/env-setup.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eu -o pipefail + +echo -en "OAUTH_CALLBACK=https://3000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}/callback" > $GITPOD_REPO_ROOT/docs/.env diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89c593323..0ed15759a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,40 @@ If you are able to resolve an issue, or have improvements you would like to prop * * * +## Example projects + +The Druxt monorepo contains a collection of example projects inside the aptly named "examples/" directory. + +All projects are connected to the locally built codebase and should be used for testing during development. + +All examples use the Drupal instance located @ `docs/drupal` (`cd docs/drupal && ddev start && ddev drupal-install`). + +### Custom module + +This a a bare bones example of a custom DruxtModule. + +`cd examples/custom-module && yarn && yarn dev` + +### DruxtSite + +This is an example of a basic, un-themed DruxtSite with support for authenticated users. + +`yarn example:druxt-site` + +### Entity form + +A basic contact form example of the DruxtEntityForm component. + +`cd examples/entity-form && yarn && yarn dev` + +### Node client + +A non-Nuxt example, using the DruxtClient in a basic node app. + +`cd examples/node-client && yarn && yarn dev` + +* * * + ## Development tools The Druxt repository is setup with tools and automated processes to help with development and to ensure a maintainable project: diff --git a/docs/.env b/docs/.env new file mode 100644 index 000000000..5b401916e --- /dev/null +++ b/docs/.env @@ -0,0 +1 @@ +OAUTH_CALLBACK=http://localhost:3000/callback diff --git a/docs/drupal/.ddev/commands/web/drupal-install b/docs/drupal/.ddev/commands/web/drupal-install index c41c83a82..9d51c2716 100755 --- a/docs/drupal/.ddev/commands/web/drupal-install +++ b/docs/drupal/.ddev/commands/web/drupal-install @@ -6,3 +6,4 @@ composer install drush -y tome:install +drush cache:rebuild diff --git a/docs/drupal/.ddev/commands/web/gitpod-config b/docs/drupal/.ddev/commands/web/gitpod-config new file mode 100755 index 000000000..cb1ec2620 --- /dev/null +++ b/docs/drupal/.ddev/commands/web/gitpod-config @@ -0,0 +1,16 @@ +#!/bin/bash + +## Description: Update Gitpod configuration in Drupal +## Usage: gitpod-config +## Example: "ddev gitpod-config" + +# Update the Consumer redirect URL. +drush php-eval ' +$consumer = \Drupal::service("entity.repository")->loadEntityByUuid("consumer", "1a6b8816-26de-4b70-bcdf-919600542f03"); +$consumer->redirect = getenv("OAUTH_CALLBACK") ?: "http://localhost:3000/callback"; +# var_dump($consumer->redirect->value); +$consumer->save(); +' + +# Rebuild cache. +drush cache:rebuild diff --git a/docs/drupal/.ddev/docker-compose.env.yaml b/docs/drupal/.ddev/docker-compose.env.yaml new file mode 100644 index 000000000..58a74b641 --- /dev/null +++ b/docs/drupal/.ddev/docker-compose.env.yaml @@ -0,0 +1,8 @@ +version: '3.6' + +services: + web: + env_file: + - "$PWD/../.env" + volumes: + - "$PWD/../.env:/var/www/html/.env" diff --git a/docs/drupal/composer.json b/docs/drupal/composer.json index 3abfaa25d..0aed4aed4 100644 --- a/docs/drupal/composer.json +++ b/docs/drupal/composer.json @@ -24,6 +24,7 @@ "drupal/decoupled_router": "2.0.3", "drupal/druxt": "^1.1.1", "drupal/jsonapi_hypermedia": "^1.6", + "drupal/simple_oauth": "^5.2", "drupal/tome": "^1.6", "drush/drush": "^11.0" }, diff --git a/docs/drupal/composer.lock b/docs/drupal/composer.lock index cb1659d6e..1035b7323 100644 --- a/docs/drupal/composer.lock +++ b/docs/drupal/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ac31ae0944733c873b16a3e657d0ac2", + "content-hash": "790ceeab906f81711a7f7de8b299b13e", "packages": [ { "name": "asm89/stack-cors", @@ -951,6 +951,72 @@ }, "time": "2022-01-25T19:21:20+00:00" }, + { + "name": "defuse/php-encryption", + "version": "v2.3.1", + "source": { + "type": "git", + "url": "https://github.com/defuse/php-encryption.git", + "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/77880488b9954b7884c25555c2a0ea9e7053f9d2", + "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "paragonie/random_compat": ">= 2", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4|^5|^6|^7|^8|^9" + }, + "bin": [ + "bin/generate-defuse-key" + ], + "type": "library", + "autoload": { + "psr-4": { + "Defuse\\Crypto\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Hornby", + "email": "taylor@defuse.ca", + "homepage": "https://defuse.ca/" + }, + { + "name": "Scott Arciszewski", + "email": "info@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "Secure PHP Encryption Library", + "keywords": [ + "aes", + "authenticated encryption", + "cipher", + "crypto", + "cryptography", + "encrypt", + "encryption", + "openssl", + "security", + "symmetric key cryptography" + ], + "support": { + "issues": "https://github.com/defuse/php-encryption/issues", + "source": "https://github.com/defuse/php-encryption/tree/v2.3.1" + }, + "time": "2021-04-09T23:57:26+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.1", @@ -1297,6 +1363,54 @@ }, "time": "2022-02-18T06:20:45+00:00" }, + { + "name": "drupal/consumers", + "version": "1.13.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/consumers.git", + "reference": "8.x-1.13" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/consumers-8.x-1.13.zip", + "reference": "8.x-1.13", + "shasum": "6cb3a738e09698c539c0cf77c651fe4384eb359f" + }, + "require": { + "drupal/core": "^8 || ^9 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.13", + "datestamp": "1657809825", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "e0ipso", + "homepage": "https://www.drupal.org/user/550110" + }, + { + "name": "eojthebrave", + "homepage": "https://www.drupal.org/user/79230" + } + ], + "description": "Declare all the consumers of your API", + "homepage": "https://www.drupal.org/project/consumers", + "support": { + "source": "https://git.drupalcode.org/project/consumers" + } + }, { "name": "drupal/core", "version": "9.3.9", @@ -2069,6 +2183,76 @@ "source": "https://git.drupalcode.org/project/jsonapi_views" } }, + { + "name": "drupal/simple_oauth", + "version": "5.2.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/simple_oauth.git", + "reference": "5.2.0" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/simple_oauth-5.2.0.zip", + "reference": "5.2.0", + "shasum": "3d2b0f38284190a59e4ac99d6f5d4af424c4d19f" + }, + "require": { + "drupal/consumers": "^1.2", + "drupal/core": "^8 || ^9", + "lcobucci/jwt": "^4", + "league/oauth2-server": "^8.3", + "php": ">=7.4", + "steverhoades/oauth2-openid-connect-server": "^2.4" + }, + "require-dev": { + "phpspec/prophecy-phpunit": "^2" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "5.2.0", + "datestamp": "1641403293", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Mateu Aguiló Bosch", + "homepage": "https://www.drupal.org/user/2801849", + "email": "mateu.aguilo.bosch@gmail.com" + }, + { + "name": "bradjones1", + "homepage": "https://www.drupal.org/user/405824" + }, + { + "name": "e0ipso", + "homepage": "https://www.drupal.org/user/550110" + }, + { + "name": "pcambra", + "homepage": "https://www.drupal.org/user/122101" + } + ], + "description": "The Simple OAuth module for Drupal", + "homepage": "https://www.drupal.org/project/simple_oauth", + "support": { + "source": "https://git.drupalcode.org/project/simple_oauth" + } + }, { "name": "drupal/tome", "version": "1.6.0", @@ -3138,6 +3322,141 @@ ], "time": "2021-11-10T11:33:52+00:00" }, + { + "name": "lcobucci/clock", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/clock.git", + "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "infection/infection": "^0.17", + "lcobucci/coding-standard": "^6.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/php-code-coverage": "9.1.4", + "phpunit/phpunit": "9.3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com" + } + ], + "description": "Yet another clock abstraction", + "support": { + "issues": "https://github.com/lcobucci/clock/issues", + "source": "https://github.com/lcobucci/clock/tree/2.0.x" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2020-08-27T18:56:02+00:00" + }, + { + "name": "lcobucci/jwt", + "version": "4.1.5", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/fe2d89f2eaa7087af4aa166c6f480ef04e000582", + "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582", + "shasum": "" + }, + "require": { + "ext-hash": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-sodium": "*", + "lcobucci/clock": "^2.0", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "infection/infection": "^0.21", + "lcobucci/coding-standard": "^6.0", + "mikey179/vfsstream": "^1.6.7", + "phpbench/phpbench": "^1.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/php-invoker": "^3.1", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "support": { + "issues": "https://github.com/lcobucci/jwt/issues", + "source": "https://github.com/lcobucci/jwt/tree/4.1.5" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2021-09-28T19:34:56+00:00" + }, { "name": "league/container", "version": "4.2.0", @@ -3220,6 +3539,318 @@ ], "time": "2021-11-16T10:29:06+00:00" }, + { + "name": "league/event", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/event.git", + "reference": "d2cc124cf9a3fab2bb4ff963307f60361ce4d119" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/event/zipball/d2cc124cf9a3fab2bb4ff963307f60361ce4d119", + "reference": "d2cc124cf9a3fab2bb4ff963307f60361ce4d119", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "~1.0.1", + "phpspec/phpspec": "^2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Event\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Event package", + "keywords": [ + "emitter", + "event", + "listener" + ], + "support": { + "issues": "https://github.com/thephpleague/event/issues", + "source": "https://github.com/thephpleague/event/tree/master" + }, + "time": "2018-11-26T11:52:41+00:00" + }, + { + "name": "league/oauth2-server", + "version": "8.3.5", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/oauth2-server.git", + "reference": "7aeb7c42b463b1a6fe4d084d3145e2fa22436876" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/oauth2-server/zipball/7aeb7c42b463b1a6fe4d084d3145e2fa22436876", + "reference": "7aeb7c42b463b1a6fe4d084d3145e2fa22436876", + "shasum": "" + }, + "require": { + "defuse/php-encryption": "^2.2.1", + "ext-json": "*", + "ext-openssl": "*", + "lcobucci/jwt": "^3.4.6 || ^4.0.4", + "league/event": "^2.2", + "league/uri": "^6.4", + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.0.1" + }, + "replace": { + "league/oauth2server": "*", + "lncd/oauth2": "*" + }, + "require-dev": { + "laminas/laminas-diactoros": "^2.4.1", + "phpstan/phpstan": "^0.12.57", + "phpstan/phpstan-phpunit": "^0.12.16", + "phpunit/phpunit": "^8.5.13", + "roave/security-advisories": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\OAuth2\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + }, + { + "name": "Andy Millington", + "email": "andrew@noexceptions.io", + "homepage": "https://www.noexceptions.io", + "role": "Developer" + } + ], + "description": "A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.", + "homepage": "https://oauth2.thephpleague.com/", + "keywords": [ + "Authentication", + "api", + "auth", + "authorisation", + "authorization", + "oauth", + "oauth 2", + "oauth 2.0", + "oauth2", + "protect", + "resource", + "secure", + "server" + ], + "support": { + "issues": "https://github.com/thephpleague/oauth2-server/issues", + "source": "https://github.com/thephpleague/oauth2-server/tree/8.3.5" + }, + "funding": [ + { + "url": "https://github.com/sephster", + "type": "github" + } + ], + "time": "2022-05-03T21:21:28+00:00" + }, + { + "name": "league/uri", + "version": "6.7.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "2d7c87a0860f3126a39f44a8a9bf2fed402dcfea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/2d7c87a0860f3126a39f44a8a9bf2fed402dcfea", + "reference": "2d7c87a0860f3126a39f44a8a9bf2fed402dcfea", + "shasum": "" + }, + "require": { + "ext-json": "*", + "league/uri-interfaces": "^2.3", + "php": "^7.4 || ^8.0", + "psr/http-message": "^1.0" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v3.3.2", + "nyholm/psr7": "^1.5", + "php-http/psr7-integration-tests": "^1.1", + "phpstan/phpstan": "^1.2.0", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0.0", + "phpstan/phpstan-strict-rules": "^1.1.0", + "phpunit/phpunit": "^9.5.10", + "psr/http-factory": "^1.0" + }, + "suggest": { + "ext-fileinfo": "Needed to create Data URI from a filepath", + "ext-intl": "Needed to improve host validation", + "league/uri-components": "Needed to easily manipulate URI objects", + "psr/http-factory": "Needed to use the URI factory" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri/issues", + "source": "https://github.com/thephpleague/uri/tree/6.7.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2022-06-29T09:48:18+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.19", + "phpstan/phpstan": "^0.12.90", + "phpstan/phpstan-phpunit": "^0.12.19", + "phpstan/phpstan-strict-rules": "^0.12.9", + "phpunit/phpunit": "^8.5.15 || ^9.5" + }, + "suggest": { + "ext-intl": "to use the IDNA feature", + "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common interface for URI representation", + "homepage": "http://github.com/thephpleague/uri-interfaces", + "keywords": [ + "rfc3986", + "rfc3987", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/thephpleague/uri-interfaces/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2021-06-28T04:27:21+00:00" + }, { "name": "masterminds/html5", "version": "2.7.5", @@ -3345,6 +3976,56 @@ }, "time": "2021-11-30T19:35:32+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, { "name": "pear/archive_tar", "version": "1.4.14", @@ -4014,6 +4695,51 @@ }, "time": "2020-01-30T12:17:27+00:00" }, + { + "name": "steverhoades/oauth2-openid-connect-server", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/steverhoades/oauth2-openid-connect-server.git", + "reference": "5f8f0246c1507dcc4d9dbcad32d651fe276c4409" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/steverhoades/oauth2-openid-connect-server/zipball/5f8f0246c1507dcc4d9dbcad32d651fe276c4409", + "reference": "5f8f0246c1507dcc4d9dbcad32d651fe276c4409", + "shasum": "" + }, + "require": { + "lcobucci/jwt": "4.1.5", + "league/oauth2-server": "^5.1|^6.0|^7.0|^8.0" + }, + "require-dev": { + "laminas/laminas-diactoros": "^1.3.2", + "phpunit/phpunit": "^5.0|^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "OpenIDConnectServer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Steve Rhoades", + "email": "sedonami@gmail.com" + } + ], + "description": "An OpenID Connect Server that sites on The PHP League's OAuth2 Server", + "support": { + "issues": "https://github.com/steverhoades/oauth2-openid-connect-server/issues", + "source": "https://github.com/steverhoades/oauth2-openid-connect-server/tree/v2.4.0" + }, + "time": "2021-10-28T13:38:28+00:00" + }, { "name": "symfony-cmf/routing", "version": "2.3.4", diff --git a/docs/drupal/config/sync/core.extension.yml b/docs/drupal/config/sync/core.extension.yml index 662ea6985..95cf9b214 100644 --- a/docs/drupal/config/sync/core.extension.yml +++ b/docs/drupal/config/sync/core.extension.yml @@ -1,3 +1,5 @@ +_core: + default_config_hash: R4IF-ClDHXxblLcG0L7MgsLvfBIMAvi_skumNFQwkDc module: automated_cron: 0 big_pipe: 0 @@ -8,6 +10,7 @@ module: color: 0 config: 0 config_translation: 0 + consumers: 0 contact: 0 content_moderation: 0 contextual: 0 @@ -49,6 +52,7 @@ module: search: 0 serialization: 0 shortcut: 0 + simple_oauth: 0 system: 0 taxonomy: 0 text: 0 @@ -69,5 +73,3 @@ theme: seven: 0 umami: 0 profile: demo_umami -_core: - default_config_hash: R4IF-ClDHXxblLcG0L7MgsLvfBIMAvi_skumNFQwkDc diff --git a/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.access_token.yml b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.access_token.yml new file mode 100644 index 000000000..a2ce5b7a4 --- /dev/null +++ b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.access_token.yml @@ -0,0 +1,10 @@ +uuid: 4850a157-fe6c-439d-bf1b-c449dd1ea545 +langcode: en +status: true +dependencies: { } +_core: + default_config_hash: z9ULI9nj9yt73YKI3ZE8v9yXhkVfvQsDJToEDzijcxY +id: access_token +label: 'Access Token' +description: 'The access token type.' +locked: true diff --git a/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.auth_code.yml b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.auth_code.yml new file mode 100644 index 000000000..b01311fb9 --- /dev/null +++ b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.auth_code.yml @@ -0,0 +1,10 @@ +uuid: 7c4ca2c0-f18a-4994-b6f9-3bde056c3af5 +langcode: en +status: true +dependencies: { } +_core: + default_config_hash: zYKaSl4QZrKMFj7aIhSGDRcBy4SoNjvY2EZlT7amrBk +id: auth_code +label: 'Auth code' +description: 'The auth code type.' +locked: true diff --git a/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.refresh_token.yml b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.refresh_token.yml new file mode 100644 index 000000000..d55e7469e --- /dev/null +++ b/docs/drupal/config/sync/simple_oauth.oauth2_token.bundle.refresh_token.yml @@ -0,0 +1,10 @@ +uuid: 1e985ded-2165-4770-a214-6cc5b0cf1b1e +langcode: en +status: true +dependencies: { } +_core: + default_config_hash: YWMv3Do9fsPFhylyFkOwcqcFP4jSU6DLRootOlgrC0M +id: refresh_token +label: 'Refresh token' +description: 'The refresh token type.' +locked: true diff --git a/docs/drupal/config/sync/simple_oauth.settings.yml b/docs/drupal/config/sync/simple_oauth.settings.yml new file mode 100644 index 000000000..dfb3a3a2b --- /dev/null +++ b/docs/drupal/config/sync/simple_oauth.settings.yml @@ -0,0 +1,11 @@ +_core: + default_config_hash: KsPFWSp6mgXIQgjBJEShfKUGn6VLRlbpIJ2EysXvXWM +access_token_expiration: 300 +authorization_code_expiration: 300 +refresh_token_expiration: 1209600 +token_cron_batch_size: 0 +public_key: ../keys/public.key +private_key: ../keys/private.key +remember_clients: true +use_implicit: false +disable_openid_connect: false diff --git a/docs/drupal/content/consumer.1a6b8816-26de-4b70-bcdf-919600542f03.json b/docs/drupal/content/consumer.1a6b8816-26de-4b70-bcdf-919600542f03.json new file mode 100644 index 000000000..72e984ced --- /dev/null +++ b/docs/drupal/content/consumer.1a6b8816-26de-4b70-bcdf-919600542f03.json @@ -0,0 +1,62 @@ +{ + "uuid": [ + { + "value": "1a6b8816-26de-4b70-bcdf-919600542f03" + } + ], + "langcode": [ + { + "value": "en" + } + ], + "owner_id": [ + { + "target_type": "user", + "target_uuid": "1bc973b1-4bee-403f-8f76-52387c936207" + } + ], + "label": [ + { + "value": "Default Consumer" + } + ], + "description": [ + { + "value": "This is the default consumer. This was created programmatically when the Consumers module was first installed. Feel free to edit, or delete this." + } + ], + "image": [], + "third_party": [ + { + "value": true + } + ], + "is_default": [ + { + "value": true + } + ], + "default_langcode": [ + { + "value": true + } + ], + "secret": [], + "confidential": [ + { + "value": false + } + ], + "roles": [], + "redirect": [ + { + "value": "http:\/\/localhost:3000\/callback" + } + ], + "user_id": [], + "pkce": [ + { + "value": true + } + ] +} \ No newline at end of file diff --git a/docs/drupal/content/meta/index.json b/docs/drupal/content/meta/index.json index 41b79ca34..93c4bcac1 100644 --- a/docs/drupal/content/meta/index.json +++ b/docs/drupal/content/meta/index.json @@ -943,5 +943,8 @@ "user.8757c97f-7c55-4367-9237-72eb7eba10cd": [], "user.9037d975-34ff-4020-b8ff-18cf8715361a": [], "user.a80fc6ed-2669-4a56-88bf-1c9590437115": [], - "user.b8245fe3-b0e8-4300-89e9-733dc6c4a52b": [] + "user.b8245fe3-b0e8-4300-89e9-733dc6c4a52b": [], + "consumer.1a6b8816-26de-4b70-bcdf-919600542f03": [ + "user.1bc973b1-4bee-403f-8f76-52387c936207" + ] } \ No newline at end of file diff --git a/docs/drupal/keys/private.key b/docs/drupal/keys/private.key new file mode 100644 index 000000000..6c0ed79b2 --- /dev/null +++ b/docs/drupal/keys/private.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +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 +DFpyW0fNY0HsVbtHL9ixvh60U7EBdco= +-----END PRIVATE KEY----- diff --git a/docs/drupal/keys/public.key b/docs/drupal/keys/public.key new file mode 100644 index 000000000..b1a9820cf --- /dev/null +++ b/docs/drupal/keys/public.key @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0HjXQyr8zaT+xN+BOcpr +PxN95AZPZTiZrcFA8vK5yI+lutDG/ClKlyuWEEv63ndvn/ZBlRyzY7Squw9qit3i +SQYIWS6ZFQ9QHmSoE/9ySCWV+xu2UXIYFuWb8GpSpdgowRWllsOwgMk+U4kr6X0N +PQvex9Ebsdd7vsJGyZOSC/5adhbOoSlCRBxYqr0V2r2MHsaTmk8COOHTwEZN1Cwh +o3tHacn5w6gaagBAeS9g5zKjFdEk0V1ChPlJG2HRmdTjlZjZGUgqwu1YlyxwNPmH +vykD3/Pcu/YqGLRQQ0rwO3dK8Sl/jLrMXkECrWq1cXagh8F5Xur2zauKcnSwR4Cu +BPKBLELB64/IE7xTx8fvMRMet5U8N+FHG0L/Y+fx2+liD32/C2tznkjnp5LWbSiE +hra4InDq1fW5++30paFuyS0WJBBsCc+zvdbqSRIUWr/C+73UlpeQ48qvXkmo/uPi +ROGHPBHT92P/s8kILiQL5jphCMMV+utF8e5F63BgDT2kPE3/jSWk+5FXdu6IzyaY +sJNMsoBHbQ3jNDDwOGlBv+M1UaB2JwM06NPXsXemDxHy5qM+5x4mrkvyZBLNkXhi +P542DQTf81zlSnWX+dJK11r90Sjsgq4JF9sp5vpjW26/tKOY1VsvJRhQ0msQ9een +mRWsWZBVgITotrfyzvuObIcCAwEAAQ== +-----END PUBLIC KEY----- diff --git a/docs/drupal/web/sites/default/services.yml b/docs/drupal/web/sites/default/services.yml new file mode 100644 index 000000000..2455047f0 --- /dev/null +++ b/docs/drupal/web/sites/default/services.yml @@ -0,0 +1,191 @@ +parameters: + session.storage.options: + # Default ini options for sessions. + # + # Some distributions of Linux (most notably Debian) ship their PHP + # installations with garbage collection (gc) disabled. Since Drupal depends + # on PHP's garbage collection for clearing sessions, ensure that garbage + # collection occurs by using the most common settings. + # @default 1 + gc_probability: 1 + # @default 100 + gc_divisor: 100 + # + # Set session lifetime (in seconds), i.e. the grace period for session + # data. Sessions are deleted by the session garbage collector after one + # session lifetime has elapsed since the user's last visit. When a session + # is deleted, authenticated users are logged out, and the contents of the + # user's session is discarded. + # @default 200000 + gc_maxlifetime: 200000 + # + # Set session cookie lifetime (in seconds), i.e. the time from the session + # is created to the cookie expires, i.e. when the browser is expected to + # discard the cookie. The value 0 means "until the browser is closed". + # @default 2000000 + cookie_lifetime: 2000000 + # + # Drupal automatically generates a unique session cookie name based on the + # full domain name used to access the site. This mechanism is sufficient + # for most use-cases, including multi-site deployments. However, if it is + # desired that a session can be reused across different subdomains, the + # cookie domain needs to be set to the shared base domain. Doing so assures + # that users remain logged in as they cross between various subdomains. + # To maximize compatibility and normalize the behavior across user agents, + # the cookie domain should start with a dot. + # + # @default none + # cookie_domain: '.example.com' + # + # Set the session ID string length. The length can be between 22 to 256. The + # PHP recommended value is 48. See + # https://www.php.net/manual/session.security.ini.php for more information. + # This value should be kept in sync with + # \Drupal\Core\Session\SessionConfiguration::__construct() + # @default 48 + sid_length: 48 + # + # Set the number of bits in encoded session ID character. The possible + # values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", + # ","). The PHP recommended value is 6. See + # https://www.php.net/manual/session.security.ini.php for more information. + # This value should be kept in sync with + # \Drupal\Core\Session\SessionConfiguration::__construct() + # @default 6 + sid_bits_per_character: 6 + twig.config: + # Twig debugging: + # + # When debugging is enabled: + # - The markup of each Twig template is surrounded by HTML comments that + # contain theming information, such as template file name suggestions. + # - Note that this debugging markup will cause automated tests that directly + # check rendered HTML to fail. When running automated tests, 'debug' + # should be set to FALSE. + # - The dump() function can be used in Twig templates to output information + # about template variables. + # - Twig templates are automatically recompiled whenever the source code + # changes (see auto_reload below). + # + # For more information about debugging Twig templates, see + # https://www.drupal.org/node/1906392. + # + # Enabling Twig debugging is not recommended in production environments. + # @default false + debug: false + # Twig auto-reload: + # + # Automatically recompile Twig templates whenever the source code changes. + # If you don't provide a value for auto_reload, it will be determined + # based on the value of debug. + # + # Enabling auto-reload is not recommended in production environments. + # @default null + auto_reload: null + # Twig cache: + # + # By default, Twig templates will be compiled and stored in the filesystem + # to increase performance. Disabling the Twig cache will recompile the + # templates from source each time they are used. In most cases the + # auto_reload setting above should be enabled rather than disabling the + # Twig cache. + # + # Disabling the Twig cache is not recommended in production environments. + # @default true + cache: true + renderer.config: + # Renderer required cache contexts: + # + # The Renderer will automatically associate these cache contexts with every + # render array, hence varying every render array by these cache contexts. + # + # @default ['languages:language_interface', 'theme', 'user.permissions'] + required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions'] + # Renderer automatic placeholdering conditions: + # + # Drupal allows portions of the page to be automatically deferred when + # rendering to improve cache performance. That is especially helpful for + # cache contexts that vary widely, such as the active user. On some sites + # those may be different, however, such as sites with only a handful of + # users. If you know what the high-cardinality cache contexts are for your + # site, specify those here. If you're not sure, the defaults are fairly safe + # in general. + # + # For more information about rendering optimizations see + # https://www.drupal.org/developing/api/8/render/arrays/cacheability#optimizing + auto_placeholder_conditions: + # Max-age at or below which caching is not considered worthwhile. + # + # Disable by setting to -1. + # + # @default 0 + max-age: 0 + # Cache contexts with a high cardinality. + # + # Disable by setting to []. + # + # @default ['session', 'user'] + contexts: ['session', 'user'] + # Tags with a high invalidation frequency. + # + # Disable by setting to []. + # + # @default [] + tags: [] + # Cacheability debugging: + # + # Responses with cacheability metadata (CacheableResponseInterface instances) + # get X-Drupal-Cache-Tags, X-Drupal-Cache-Contexts and X-Drupal-Cache-Max-Age + # headers. + # + # For more information about debugging cacheable responses, see + # https://www.drupal.org/developing/api/8/response/cacheable-response-interface + # + # Enabling cacheability debugging is not recommended in production + # environments. + # @default false + http.response.debug_cacheability_headers: false + factory.keyvalue: {} + # Default key/value storage service to use. + # @default keyvalue.database + # default: keyvalue.database + # Collection-specific overrides. + # state: keyvalue.database + factory.keyvalue.expirable: {} + # Default key/value expirable storage service to use. + # @default keyvalue.database.expirable + # default: keyvalue.database.expirable + # Allowed protocols for URL generation. + filter_protocols: + - http + - https + - ftp + - news + - nntp + - tel + - telnet + - mailto + - irc + - ssh + - sftp + - webcal + - rtsp + + # Configure Cross-Site HTTP requests (CORS). + # Read https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS + # for more information about the topic in general. + # Note: By default the configuration is disabled. + cors.config: + enabled: true + # Specify allowed headers, like 'x-allowed-header'. + allowedHeaders: ['*'] + # Specify allowed request methods, specify ['*'] to allow all possible ones. + allowedMethods: ['*'] + # Configure requests allowed from specific origins. + allowedOrigins: ['*'] + # Sets the Access-Control-Expose-Headers header. + exposedHeaders: false + # Sets the Access-Control-Max-Age header. + maxAge: false + # Sets the Access-Control-Allow-Credentials header. + supportsCredentials: false diff --git a/examples/druxt-site/nuxt.config.js b/examples/druxt-site/nuxt.config.js index 05019cf2a..b3954b66f 100644 --- a/examples/druxt-site/nuxt.config.js +++ b/examples/druxt-site/nuxt.config.js @@ -6,11 +6,20 @@ export default { generate: { routes: ['/'] }, telemetry: true, buildModules: ['@nuxt/postcss8'], - modules: ['druxt-site'], + modules: [ + 'druxt-auth', + 'druxt-site' + ], druxt: { // The baseUrl of the Druxt enabled Drupal JSON:API server. baseUrl, + // DruxtAuth module settings; https://github.com/druxt/druxt-auth + auth: { + // OAuth consumer ID. + clientId: '1a6b8816-26de-4b70-bcdf-919600542f03', + }, + // Set the JSON:API endpoint, `/jsonapi` by default. // endpoint: '/api/v1' diff --git a/examples/druxt-site/package.json b/examples/druxt-site/package.json index 1f9996fbe..b8c5f0e72 100644 --- a/examples/druxt-site/package.json +++ b/examples/druxt-site/package.json @@ -7,6 +7,7 @@ "storybook": "nuxt storybook" }, "dependencies": { + "druxt-auth": "^0.1.0", "druxt-site": "link:../../../packages/druxt-site", "nuxt": "latest" }, diff --git a/examples/druxt-site/pages/_langcode/user/login.vue b/examples/druxt-site/pages/_langcode/user/login.vue new file mode 100644 index 000000000..da41c403d --- /dev/null +++ b/examples/druxt-site/pages/_langcode/user/login.vue @@ -0,0 +1,15 @@ + + + diff --git a/examples/druxt-site/yarn.lock b/examples/druxt-site/yarn.lock index 72f31c160..722222c67 100644 --- a/examples/druxt-site/yarn.lock +++ b/examples/druxt-site/yarn.lock @@ -1499,7 +1499,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.0, @babel/runtime@npm:^7.8.4": +"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.15.4, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.0, @babel/runtime@npm:^7.8.4": version: 7.18.9 resolution: "@babel/runtime@npm:7.18.9" dependencies: @@ -2209,6 +2209,47 @@ __metadata: languageName: node linkType: hard +"@nuxtjs/auth-next@npm:^5.0.0-1643791578.532b3d6": + version: 5.0.0-1648802546.c9880dc + resolution: "@nuxtjs/auth-next@npm:5.0.0-1648802546.c9880dc" + dependencies: + "@nuxtjs/axios": ^5.13.6 + axios: ^0.26.1 + body-parser: ^1.19.2 + consola: ^2.15.3 + cookie: ^0.4.2 + defu: ^5.0.1 + hasha: ^5.2.2 + jwt-decode: ^3.1.2 + requrl: ^3.0.2 + peerDependencies: + vue: "*" + checksum: 832dc08d435a34b16447bd9a8ea1eea7f042ff693cb69a3ca290cc584831d7e9a9f0cb78dbc007ad7055ec2e2bda1857626acd1ef28b12961fcadf43b56d40c4 + languageName: node + linkType: hard + +"@nuxtjs/axios@npm:^5.13.6": + version: 5.13.6 + resolution: "@nuxtjs/axios@npm:5.13.6" + dependencies: + "@nuxtjs/proxy": ^2.1.0 + axios: ^0.21.1 + axios-retry: ^3.1.9 + consola: ^2.15.3 + defu: ^5.0.0 + checksum: 0af1cda9833dc6c37eb377a9313b421e030588d5a668b453259f68ff994967480c8b4928577751682fd8d3ca649391b05817003d172c1f62c6edb0aedd9eaf55 + languageName: node + linkType: hard + +"@nuxtjs/proxy@npm:^2.1.0": + version: 2.1.0 + resolution: "@nuxtjs/proxy@npm:2.1.0" + dependencies: + http-proxy-middleware: ^1.0.6 + checksum: 37e607bcd1e864b116a1fb9a8fbf1d6a429515156861e9ad9993e9014bdeded00a3d0ac1c7192632d850f26a44d9847d1743be9e65fc7d82118f4a8605017169 + languageName: node + linkType: hard + "@nuxtjs/storybook@npm:latest": version: 4.3.2 resolution: "@nuxtjs/storybook@npm:4.3.2" @@ -3403,6 +3444,15 @@ __metadata: languageName: node linkType: hard +"@types/http-proxy@npm:^1.17.5": + version: 1.17.9 + resolution: "@types/http-proxy@npm:1.17.9" + dependencies: + "@types/node": "*" + checksum: 7a6746d00729b2a9fe9f9dd3453430b099931df879ec8f7a7b5f07b1795f6d99b0512640c45a67390b1e4bacb9401e36824952aeeaf089feba8627a063cf8e00 + languageName: node + linkType: hard + "@types/is-function@npm:^1.0.0": version: 1.0.1 resolution: "@types/is-function@npm:1.0.1" @@ -4780,6 +4830,34 @@ __metadata: languageName: node linkType: hard +"axios-retry@npm:^3.1.9": + version: 3.3.1 + resolution: "axios-retry@npm:3.3.1" + dependencies: + "@babel/runtime": ^7.15.4 + is-retry-allowed: ^2.2.0 + checksum: 125c75e08048a28de5d0dfa9de9a1924185d863a4323a71472646a1d5a326f727ff59e75e1b557220da1aad7cba01222c47c26194c5940f295378668dd3b9163 + languageName: node + linkType: hard + +"axios@npm:^0.21.1": + version: 0.21.4 + resolution: "axios@npm:0.21.4" + dependencies: + follow-redirects: ^1.14.0 + checksum: 44245f24ac971e7458f3120c92f9d66d1fc695e8b97019139de5b0cc65d9b8104647db01e5f46917728edfc0cfd88eb30fc4c55e6053eef4ace76768ce95ff3c + languageName: node + linkType: hard + +"axios@npm:^0.26.1": + version: 0.26.1 + resolution: "axios@npm:0.26.1" + dependencies: + follow-redirects: ^1.14.8 + checksum: d9eb58ff4bc0b36a04783fc9ff760e9245c829a5a1052ee7ca6013410d427036b1d10d04e7380c02f3508c5eaf3485b1ae67bd2adbfec3683704745c8d7a6e1a + languageName: node + linkType: hard + "babel-core@npm:^7.0.0-bridge.0": version: 7.0.0-bridge.0 resolution: "babel-core@npm:7.0.0-bridge.0" @@ -5018,7 +5096,7 @@ __metadata: languageName: node linkType: hard -"body-parser@npm:1.20.0": +"body-parser@npm:1.20.0, body-parser@npm:^1.19.2": version: 1.20.0 resolution: "body-parser@npm:1.20.0" dependencies: @@ -6068,6 +6146,13 @@ __metadata: languageName: node linkType: hard +"cookie@npm:^0.4.2": + version: 0.4.2 + resolution: "cookie@npm:0.4.2" + checksum: a00833c998bedf8e787b4c342defe5fa419abd96b32f4464f718b91022586b8f1bafbddd499288e75c037642493c83083da426c6a9080d309e3bd90fd11baa9b + languageName: node + linkType: hard + "copy-concurrently@npm:^1.0.0": version: 1.0.5 resolution: "copy-concurrently@npm:1.0.5" @@ -6746,7 +6831,7 @@ __metadata: languageName: node linkType: hard -"defu@npm:^5.0.0": +"defu@npm:^5.0.0, defu@npm:^5.0.1": version: 5.0.1 resolution: "defu@npm:5.0.1" checksum: f65556c2e8aa7789080f04c1d52fd7188d8258d9bc7f673e5bedc6be33eb6150f41844ac96aec99c798e47eb9beb97dae03c24edd73d3ddc643e4c7c72124606 @@ -7030,6 +7115,15 @@ __metadata: languageName: node linkType: hard +"druxt-auth@npm:^0.1.0": + version: 0.1.0 + resolution: "druxt-auth@npm:0.1.0" + dependencies: + "@nuxtjs/auth-next": ^5.0.0-1643791578.532b3d6 + checksum: 2f8d1df7fb105255c4c53086875cb68fc993bfa9bd00e50269595e45afc65752a14e3d3c3ae6c59d23006c3de61e84a67fd4f7252c9a91cabe8335ee3f614782 + languageName: node + linkType: hard + "druxt-site@link:../../../packages/druxt-site::locator=druxt-site%40workspace%3A.": version: 0.0.0-use.local resolution: "druxt-site@link:../../../packages/druxt-site::locator=druxt-site%40workspace%3A." @@ -7042,6 +7136,7 @@ __metadata: dependencies: "@nuxt/postcss8": latest "@nuxtjs/storybook": latest + druxt-auth: ^0.1.0 druxt-site: "link:../../../packages/druxt-site" nuxt: latest postcss: latest @@ -7407,6 +7502,13 @@ __metadata: languageName: node linkType: hard +"eventemitter3@npm:^4.0.0": + version: 4.0.7 + resolution: "eventemitter3@npm:4.0.7" + checksum: 1875311c42fcfe9c707b2712c32664a245629b42bb0a5a84439762dd0fd637fc54d078155ea83c2af9e0323c9ac13687e03cfba79b03af9f40c89b4960099374 + languageName: node + linkType: hard + "events@npm:^3.0.0, events@npm:^3.2.0": version: 3.3.0 resolution: "events@npm:3.3.0" @@ -7895,6 +7997,16 @@ __metadata: languageName: node linkType: hard +"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.14.8": + version: 1.15.1 + resolution: "follow-redirects@npm:1.15.1" + peerDependenciesMeta: + debug: + optional: true + checksum: 6aa4e3e3cdfa3b9314801a1cd192ba756a53479d9d8cca65bf4db3a3e8834e62139245cd2f9566147c8dfe2efff1700d3e6aefd103de4004a7b99985e71dd533 + languageName: node + linkType: hard + "for-in@npm:^1.0.2": version: 1.0.2 resolution: "for-in@npm:1.0.2" @@ -8624,6 +8736,16 @@ __metadata: languageName: node linkType: hard +"hasha@npm:^5.2.2": + version: 5.2.2 + resolution: "hasha@npm:5.2.2" + dependencies: + is-stream: ^2.0.0 + type-fest: ^0.8.0 + checksum: 06cc474bed246761ff61c19d629977eb5f53fa817be4313a255a64ae0f433e831a29e83acb6555e3f4592b348497596f1d1653751008dda4f21c9c21ca60ac5a + languageName: node + linkType: hard + "hast-to-hyperscript@npm:^9.0.0": version: 9.0.1 resolution: "hast-to-hyperscript@npm:9.0.1" @@ -8876,6 +8998,30 @@ __metadata: languageName: node linkType: hard +"http-proxy-middleware@npm:^1.0.6": + version: 1.3.1 + resolution: "http-proxy-middleware@npm:1.3.1" + dependencies: + "@types/http-proxy": ^1.17.5 + http-proxy: ^1.18.1 + is-glob: ^4.0.1 + is-plain-obj: ^3.0.0 + micromatch: ^4.0.2 + checksum: c6f0fe6d5aa58f3757084f1fad8109e7384fdea1b0a5c62f58ac767c42f367a18d3819bed8cbf8b5183f17e3e14fad04322f179c569629004da5fbec9b81a88a + languageName: node + linkType: hard + +"http-proxy@npm:^1.18.1": + version: 1.18.1 + resolution: "http-proxy@npm:1.18.1" + dependencies: + eventemitter3: ^4.0.0 + follow-redirects: ^1.0.0 + requires-port: ^1.0.0 + checksum: f5bd96bf83e0b1e4226633dbb51f8b056c3e6321917df402deacec31dd7fe433914fc7a2c1831cf7ae21e69c90b3a669b8f434723e9e8b71fd68afe30737b6a5 + languageName: node + linkType: hard + "https-browserify@npm:^1.0.0": version: 1.0.0 resolution: "https-browserify@npm:1.0.0" @@ -9553,6 +9699,13 @@ __metadata: languageName: node linkType: hard +"is-plain-obj@npm:^3.0.0": + version: 3.0.0 + resolution: "is-plain-obj@npm:3.0.0" + checksum: a6ebdf8e12ab73f33530641972a72a4b8aed6df04f762070d823808303e4f76d87d5ea5bd76f96a7bbe83d93f04ac7764429c29413bd9049853a69cb630fb21c + languageName: node + linkType: hard + "is-plain-object@npm:^2.0.3, is-plain-object@npm:^2.0.4": version: 2.0.4 resolution: "is-plain-object@npm:2.0.4" @@ -9586,6 +9739,13 @@ __metadata: languageName: node linkType: hard +"is-retry-allowed@npm:^2.2.0": + version: 2.2.0 + resolution: "is-retry-allowed@npm:2.2.0" + checksum: 3d1103a9290b5d03626756a41054844633eac78bc5d3e3a95b13afeae94fa3cfbcf7f0b5520d83f75f48a25ce7b142fdbac4217dc4b0630f3ea55e866ec3a029 + languageName: node + linkType: hard + "is-set@npm:^2.0.2": version: 2.0.2 resolution: "is-set@npm:2.0.2" @@ -10053,6 +10213,13 @@ __metadata: languageName: node linkType: hard +"jwt-decode@npm:^3.1.2": + version: 3.1.2 + resolution: "jwt-decode@npm:3.1.2" + checksum: 20a4b072d44ce3479f42d0d2c8d3dabeb353081ba4982e40b83a779f2459a70be26441be6c160bfc8c3c6eadf9f6380a036fbb06ac5406b5674e35d8c4205eeb + languageName: node + linkType: hard + "kind-of@npm:^3.0.2, kind-of@npm:^3.0.3, kind-of@npm:^3.2.0": version: 3.2.2 resolution: "kind-of@npm:3.2.2" @@ -14011,6 +14178,20 @@ __metadata: languageName: node linkType: hard +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: eee0e303adffb69be55d1a214e415cf42b7441ae858c76dfc5353148644f6fd6e698926fc4643f510d5c126d12a705e7c8ed7e38061113bdf37547ab356797ff + languageName: node + linkType: hard + +"requrl@npm:^3.0.2": + version: 3.0.2 + resolution: "requrl@npm:3.0.2" + checksum: 84fbaf4326050de145fdb6037b77416c649453fa1cce19df25776e13b5b89a119224213c2d786acda088b5724b9e085a41aa6d59bf9c3fa19345fc49c7902c7f + languageName: node + linkType: hard + "resolve-from@npm:^3.0.0": version: 3.0.0 resolution: "resolve-from@npm:3.0.0" @@ -15664,7 +15845,7 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^0.8.1": +"type-fest@npm:^0.8.0, type-fest@npm:^0.8.1": version: 0.8.1 resolution: "type-fest@npm:0.8.1" checksum: d61c4b2eba24009033ae4500d7d818a94fd6d1b481a8111612ee141400d5f1db46f199c014766b9fa9b31a6a7374d96fc748c6d688a78a3ce5a33123839becb7 diff --git a/package.json b/package.json index 1adf00a7e..816b3c898 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "clean:dist": "rimraf packages/*/dist packages/*/nuxt || true", "clean:pack": "rimraf packages/*/package.tgz || true", "dev": "siroc dev", + "example:druxt-site": "cd examples/druxt-site && yarn && yarn dev", "lint": "eslint --ext .js,.vue packages/*/src", "lint:commit": "commitlint", "lint:renovate": "renovate-config-validator",