Skip to content

Commit

Permalink
bugsnag
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum committed Feb 17, 2023
1 parent 3bc0e71 commit f8e37cc
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 9 deletions.
20 changes: 14 additions & 6 deletions app/Http/Controllers/RegistrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public function generateOptions(Request $request)
->setAttestation(
PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_NONE
)
->setAuthenticatorSelection(AuthenticatorSelectionCriteria::create())
->setAuthenticatorSelection(
AuthenticatorSelectionCriteria::create()
)
->setExtensions(AuthenticationExtensionsClientInputs::createFromArray([
'credProps' => true,
]))
Expand All @@ -100,19 +102,25 @@ public function generateOptions(Request $request)
)->toArray()
);

$serializedPublicKeyCredentialCreationOptions = $publicKeyCredentialCreationOptions->jsonSerialize();
$serializedOptions = $publicKeyCredentialCreationOptions->jsonSerialize();

if (!isset($serializedPublicKeyCredentialCreationOptions['excludeCredentials'])) {
if (!isset($serializedOptions['excludeCredentials'])) {
// The JS side needs this, so let's set it up for success with an empty array
$serializedPublicKeyCredentialCreationOptions['excludeCredentials'] = [];
$serializedOptions['excludeCredentials'] = [];
}

$serializedOptions['extensions'] = $serializedOptions['extensions']->jsonSerialize();

// $serializedOptions['authenticatorSelection']['residentKey'] = AuthenticatorSelectionCriteria::RESIDENT_KEY_REQUIREMENT_PREFERRED;

// ray($serializedOptions);

$request->session()->put(
self::CREDENTIAL_CREATION_OPTIONS_SESSION_KEY,
$serializedPublicKeyCredentialCreationOptions
$serializedOptions
);

return $serializedPublicKeyCredentialCreationOptions;
return $serializedOptions;
}

public function verify(Request $request, ServerRequestInterface $serverRequest)
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"license": "MIT",
"require": {
"php": "^8.0.2",
"bugsnag/bugsnag-laravel": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.0",
Expand Down
261 changes: 260 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
/*
* Application Service Providers...
*/
Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
Expand Down
10 changes: 8 additions & 2 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
// Add bugsnag to the stack:
'channels' => ['single', 'bugsnag'],
'ignore_exceptions' => false,
],

// Create a bugsnag logging channel:
'bugsnag' => [
'driver' => 'bugsnag',
],

'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
Expand Down Expand Up @@ -85,7 +91,7 @@
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'),
],
],

Expand Down
8 changes: 8 additions & 0 deletions resources/views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
<script src="https://cdn.usefathom.com/script.js" data-site="{{ config('services.fathom_analytics.id') }}" defer>
</script>
@endif

@if (app()->environment('production'))
<script src="//d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js">
</script>
<script>
Bugsnag.start({ apiKey: '6475c3116770ff30bc453a10b81f486f' })
</script>
@endif
</head>

<body class="h-full">
Expand Down

0 comments on commit f8e37cc

Please sign in to comment.