Skip to content

Commit 42e9134

Browse files
authored
Feature/issue 1971 correlation id logging (#1981)
Add correlation ID to SAML flow log tracing Assigns a correlation ID at the start of each SAML authentication flow and propagates it through all four legs (SSO, continue to IdP, assertion consumer, consent) so that log entries across the full flow can be correlated. The ID is also shown on the feedback/error page. Resolves #1971
1 parent b8c76d0 commit 42e9134

44 files changed

Lines changed: 1530 additions & 75 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/packages/ci/monolog.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
monolog:
2+
handlers:
3+
test_log_file:
4+
type: stream
5+
path: '/tmp/eb-fixtures/log-records.ndjson'
6+
level: debug
7+
formatter: monolog.formatter.json

config/packages/test/monolog.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ monolog:
1212
type: stream
1313
path: "%kernel.logs_dir%/%kernel.environment%.log"
1414
level: DEBUG
15+

config/services/ci/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,4 @@ services:
154154
arguments:
155155
- "@request_stack"
156156
- "%global.site_notice.allowed.tags%"
157+

config/services/compat.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ services:
5959
engineblock.compat.attribute_release_policy_enforcer:
6060
public: false
6161
class: EngineBlock_Arp_AttributeReleasePolicyEnforcer
62+
63+
EngineBlock_Saml2_AuthnRequestSessionRepository:
64+
class: EngineBlock_Saml2_AuthnRequestSessionRepository
65+
public: true
66+
arguments:
67+
- '@request_stack'

config/services/controllers/authentication.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ services:
3333
- '@translator'
3434
- '@twig'
3535
- '@OpenConext\EngineBlock\Service\FeedbackStateHelper'
36+
- '@OpenConext\EngineBlock\Request\CurrentCorrelationId'
3637

3738
OpenConext\EngineBlockBundle\Controller\MetadataController:
3839
arguments:

config/services/logging.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ services:
3030
tags:
3131
- { name: monolog.processor }
3232

33+
OpenConext\EngineBlock\Logger\Processor\CorrelationIdProcessor:
34+
arguments:
35+
- '@OpenConext\EngineBlock\Request\CurrentCorrelationId'
36+
tags:
37+
- { name: monolog.processor }
38+
3339
OpenConext\EngineBlock\Logger\Processor\SessionIdProcessor:
3440
tags:
3541
- { name: monolog.processor }

config/services/services.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ services:
6868
- '@OpenConext\EngineBlock\Request\UniqidGenerator'
6969
public: true
7070

71+
OpenConext\EngineBlock\Request\CurrentCorrelationId:
72+
public: true
73+
74+
OpenConext\EngineBlock\Request\CorrelationIdRepository:
75+
public: true
76+
arguments:
77+
- '@request_stack'
78+
79+
OpenConext\EngineBlock\Request\CorrelationIdService:
80+
public: true
81+
arguments:
82+
- '@OpenConext\EngineBlock\Request\CorrelationIdRepository'
83+
- '@OpenConext\EngineBlock\Request\CurrentCorrelationId'
84+
7185
OpenConext\EngineBlockBundle\Security\Http\EntryPoint\JsonBasicAuthenticationEntryPoint:
7286
arguments:
7387
- 'engine-api.%domain%'

config/services_ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ services:
6868
OpenConext\EngineBlockFunctionalTestingBundle\Features\Context\MinkContext:
6969
tags: ['fob.context']
7070

71+
OpenConext\EngineBlockFunctionalTestingBundle\Features\Context\LoggingContext:
72+
arguments:
73+
$logFile: '/tmp/eb-fixtures/log-records.ndjson'
74+
tags: ['fob.context']
75+
7176
OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\SbsClientStateManager:
7277
arguments:
7378
- "@engineblock.functional_testing.data_store.sbs_client_state_mananger"

languages/messages.en.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
// Feedback
5151
'requestId' => 'UR ID',
52+
'correlationId' => 'CID',
5253
'identityProvider' => 'IdP',
5354
'serviceProvider' => 'SP',
5455
'serviceProviderName' => 'SP Name',

languages/messages.nl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
// Feedback
5151
'requestId' => 'UR ID',
52+
'correlationId' => 'CID',
5253
'identityProvider' => 'IdP',
5354
'serviceProvider' => 'SP',
5455
'serviceProviderName' => 'SP Name',

0 commit comments

Comments
 (0)