irongate / chief-base
Base functionality and helpers used for building for Chief Tools.
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.4
- laracasts/utilities: ^3.2
- laravel/framework: ^9.5
- laravel/helpers: ^1.5
- laravel/passport: ^10.3
- laravel/socialite: ^5.5
- mll-lab/graphql-php-scalars: ^5.4
- nuwave/lighthouse: ^5.45.1
- paragonie/certainty: ^2.8
- pusher/pusher-php-server: ^7.0
- sentry/sentry-laravel: ^2.11
- stayallive/laravel-eloquent-observable: ^1.0
- stayallive/laravel-eloquent-uuid: ^1.0
- stayallive/laravel-passport-memoized: ^1.0
- tuupola/base62: ^2.1
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.8.*
- dev-develop
- v0.34.1
- v0.34.0
- v0.33.3
- v0.33.2
- v0.33.1
- v0.33.0
- v0.32.8
- v0.32.7
- v0.32.6
- v0.32.5
- v0.32.4
- v0.32.3
- v0.32.2
- v0.32.1
- v0.32.0
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.10
- v0.30.9
- v0.30.8
- v0.30.7
- v0.30.6
- v0.30.5
- v0.30.4
- v0.30.3
- v0.30.2
- v0.30.1
- v0.30.0
- v0.29.4
- v0.29.3
- v0.29.2
- v0.29.1
- v0.29.0
- v0.28.9
- v0.28.8
- v0.28.7
- v0.28.6
- v0.28.5
- v0.28.4
- v0.28.3
- v0.28.2
- v0.28.1
- v0.28.0
- v0.27.2
- v0.27.1
- v0.27.0
- v0.26.1
- v0.26.0
- v0.25.10
- v0.25.9
- v0.25.8
- v0.25.7
- v0.25.6
- v0.25.5
- v0.25.4
- v0.25.3
- v0.25.2
- v0.25.1
- v0.25.0
- v0.24.1
- v0.24.0
- v0.23.2
- v0.23.1
- v0.23.0
- 0.22.x-dev
- v0.22.9
- v0.22.8
- v0.22.7
- v0.22.6
- v0.22.5
- v0.22.4
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.0
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.0
- v0.16.0
- v0.15.0
- v0.14.3
- v0.14.2
- v0.14.1
- v0.14.0
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.0
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.21
- v0.8.20
- v0.8.19
- v0.8.18
- v0.8.17
- v0.8.16
- v0.8.15
- v0.8.14
- v0.8.13
- v0.8.12
- v0.8.11
- v0.8.10
- v0.8.9
- v0.8.8
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.0
- dev-master
- dev-dependabot/github_actions/shivammathur/setup-php-2.21.0
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.8.staror-3.9.star
- dev-dependabot/github_actions/shivammathur/cache-extensions-1.8.0
This package is auto-updated.
Last update: 2022-07-25 19:15:47 UTC
README
Base functionality and helpers used for building for Chief Tools.
Configures
- (Socialite) authentication through Account Chief
- Laravel Passport for API access
- Sentry client
- Lighthouse GraphQL with base schema and scalars
- Session protected endpoint
/api/graphql/web
- Session protected (GraphiQL) playground
/api/playground
- OAuth (Passport) protected endpoint
/api/graphql
- Session protected endpoint
- Account pages to show profile information & preferences
- Basic API documentation & Passport personal access token management
- Redirects to Chief Tools homepage for
/contact
,/privacy
,/terms
- Chief Tools webhook handler to be notified when a user account is closed or updated
- Health check queue job pinging
QUEUE_MONITOR_URL
every minute using the default queue (disabled whenQUEUE_MONITOR_URL
is empty or unset) - Login event listener to update the
last_login
column on theusers
table
Provides
Middleware
IronGate\Chief\Middleware\AuthenticateChief
Validates a request comes from Chief Tools
Requiresservices.chief.webhook_secret
configuration to be set to a random stringIronGate\Chief\Middleware\AutoAuthenticate
Uses both theapi
andweb
guard and sets the first that is authenticatedIronGate\Chief\Middleware\ForceSecure
Make sure the request is overhttps://
IronGate\Chief\Middleware\MoveAccessTokenFromURLToHeader
Move the access token fromaccess_token
GET paramater to theAuthorization
headerIronGate\Chief\Middleware\SecurityHeaders
Adds a default set of security headers, can be configured by settingchief.response.securityheaders
(array) in the app configIronGate\Chief\Middleware\TrustProxiesOnVapor
Configuresfideloper/proxy
to be used on Laravel Vapor
Validation rules
IronGate\Chief\Rules\UUID
Valites the input value is a UUIDv4
Helpers
active($whitelist = null, $blacklist = null, $active = 'active', $inactive = '')
Get active state based on whitelist. Used to indicate active menu'stimezones(): array
Return an key-value list of all timezonesvalidate($fields, $rules): bool
Validate fields against rules. Examplevalidate($id, new \IronGate\Chief\Rules\UUID)
latest_ca_bundle_file_path(): string
Get the path to the most up-to-date CA bundle file, uses Certainty under the hood
Installation
Start with requiring the package:
composer require irongate/chief
Publish the configuration files and optionally the migrations:
php artisan vendor:publish --tag=chief-config
# php artisan vendor:publish --tag=chief-migrations
Run the app migrations to create the users table:
php artisan migrate
Add the Chief service to the config/services.php
:
<?php return [ 'chief' => [ 'client_id' => env('CHIEF_CLIENT_ID'), 'client_secret' => env('CHIEF_CLIENT_SECRET'), 'webhook_secret' => env('CHIEF_SECRET'), 'base_url' => env('CHIEF_BASE_URL', 'https://account.chief.app'), 'verify' => env('CHIEF_VERIFY', true), 'redirect' => '/login/callback', ], ];
That's all, you should be able to authenticate against Account Chief.
GraphQL API
You will need to create a routes/graphql/schema.graphql
in your own project with the following contents:
#import ../../vendor/irongate/chief/routes/graphql/schema.graphql
Anything you want to add the the schema you can do thereafter, for example:
#import ../../vendor/irongate/chief/routes/graphql/schema.graphql #import ./types/*.graphql #import ./queries/*.graphql
Keep in mind that the User
type is already provided so you will need to extend that if you want to append fields.
type OfType implements Entity { id: ID! } extend type User { relation: [OfType!]! @hasMany(type: "paginator") }