Skip to content

Commit

Permalink
Merge branch 'master' into hperl/link-credentials-when-login
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored Nov 6, 2023
2 parents bc26f78 + a639e56 commit 737cf57
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 6 deletions.
36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

**Table of Contents**

- [ (2023-10-27)](#2023-10-27)
- [ (2023-10-30)](#2023-10-30)
- [Breaking Changes](#breaking-changes)
- [Bug Fixes](#bug-fixes)
- [Documentation](#documentation)
Expand Down Expand Up @@ -313,7 +313,7 @@

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# [](https://github.com/ory/kratos/compare/v1.0.0...v) (2023-10-27)
# [](https://github.com/ory/kratos/compare/v1.0.0...v) (2023-10-30)

## Breaking Changes

Expand Down Expand Up @@ -525,6 +525,28 @@ https://github.com/ory/kratos/pull/3480

- style: format

- Registration should accept hydra login
([#3592](https://github.com/ory/kratos/issues/3592))
([7a47827](https://github.com/ory/kratos/commit/7a47827cfd58ef68ebfbbeaf5ed86c394ba2bd5e)):

- fix: registration should accept hydra login

- fix: oauth2 registration flow with session

- wip: registration oauth flow tests

- wip: refactor oauth flows test

- wip: refactor op_registration_test

- wip: oauth provider registration test

- wip: refactor oauth flows test

- fix(test): oauth provider login

- style: format

- Registration with verification
([#3451](https://github.com/ory/kratos/issues/3451))
([77c3196](https://github.com/ory/kratos/commit/77c3196fd60c5927b84e9a7f6546f80ac2d78ee5))
Expand All @@ -540,6 +562,9 @@ https://github.com/ory/kratos/pull/3480
- Remove slow queries from update identities
([#3553](https://github.com/ory/kratos/issues/3553))
([d138abb](https://github.com/ory/kratos/commit/d138abb6278ebb232e120bee0fb956a0f2816b8d))
- Respect gomail.SendError in mail queue
([#3600](https://github.com/ory/kratos/issues/3600))
([9c608b9](https://github.com/ory/kratos/commit/9c608b991874d839782d9219f2fc27d0d4a398af))
- Respond with 422 when SPA identity requires AAL2
([#3572](https://github.com/ory/kratos/issues/3572))
([df18c09](https://github.com/ory/kratos/commit/df18c09e0089743e8aee17540d277b9572252e06)):
Expand Down Expand Up @@ -793,6 +818,13 @@ https://github.com/ory/kratos/pull/3480
- One-time code native flows
([#3516](https://github.com/ory/kratos/issues/3516))
([9b0fee3](https://github.com/ory/kratos/commit/9b0fee30f980d860fd548e7589fa6a06e593537a))
- Parametrize courier worker
([#3601](https://github.com/ory/kratos/issues/3601))
([0e4be57](https://github.com/ory/kratos/commit/0e4be57e41e1152f4be22f490541c2c099cfe3fe)):

Allows one to parametrize how many messages the courier will fetch and how
often it will fetch messages.

- Passwordless browser login and registration via code to email
([#3378](https://github.com/ory/kratos/issues/3378))
([eaaf375](https://github.com/ory/kratos/commit/eaaf37519917612671238412a633847386d7c613)),
Expand Down
3 changes: 2 additions & 1 deletion courier/courier.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func (c *courier) UseBackoff(b backoff.BackOff) {
}

func (c *courier) watchMessages(ctx context.Context, errChan chan error) {
wait := c.deps.CourierConfig().CourierWorkerPullWait(ctx)
c.backoff.Reset()
for {
if err := backoff.Retry(func() error {
Expand All @@ -108,6 +109,6 @@ func (c *courier) watchMessages(ctx context.Context, errChan chan error) {
errChan <- err
return
}
time.Sleep(time.Second)
time.Sleep(wait)
}
}
3 changes: 2 additions & 1 deletion courier/courier_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ func (c *courier) DispatchMessage(ctx context.Context, msg Message) error {

func (c *courier) DispatchQueue(ctx context.Context) error {
maxRetries := c.deps.CourierConfig().CourierMessageRetries(ctx)
pullCount := c.deps.CourierConfig().CourierWorkerPullCount(ctx)

messages, err := c.deps.CourierPersister().NextMessages(ctx, 10)
messages, err := c.deps.CourierPersister().NextMessages(ctx, uint8(pullCount))
if err != nil {
if errors.Is(err, ErrQueueEmpty) {
return nil
Expand Down
12 changes: 12 additions & 0 deletions driver/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ const (
ViperKeyCourierSMSEnabled = "courier.sms.enabled"
ViperKeyCourierSMSFrom = "courier.sms.from"
ViperKeyCourierMessageRetries = "courier.message_retries"
ViperKeyCourierWorkerPullCount = "courier.worker.pull_count"
ViperKeyCourierWorkerPullWait = "courier.worker.pull_wait"
ViperKeySecretsDefault = "secrets.default"
ViperKeySecretsCookie = "secrets.cookie"
ViperKeySecretsCipher = "secrets.cipher"
Expand Down Expand Up @@ -289,6 +291,8 @@ type (
CourierTemplatesLoginCodeValid(ctx context.Context) *CourierEmailTemplate
CourierTemplatesRegistrationCodeValid(ctx context.Context) *CourierEmailTemplate
CourierMessageRetries(ctx context.Context) int
CourierWorkerPullCount(ctx context.Context) int
CourierWorkerPullWait(ctx context.Context) time.Duration
}
)

Expand Down Expand Up @@ -1110,6 +1114,14 @@ func (p *Config) CourierMessageRetries(ctx context.Context) int {
return p.GetProvider(ctx).IntF(ViperKeyCourierMessageRetries, 5)
}

func (p *Config) CourierWorkerPullCount(ctx context.Context) int {
return p.GetProvider(ctx).Int(ViperKeyCourierWorkerPullCount)
}

func (p *Config) CourierWorkerPullWait(ctx context.Context) time.Duration {
return p.GetProvider(ctx).Duration(ViperKeyCourierWorkerPullWait)
}

func (p *Config) CourierSMTPHeaders(ctx context.Context) map[string]string {
return p.GetProvider(ctx).StringMap(ViperKeyCourierSMTPHeaders)
}
Expand Down
17 changes: 17 additions & 0 deletions embedx/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,23 @@
"default": 5,
"examples": [10, 60]
},
"worker": {
"description": "Configures the dispatch worker.",
"type": "object",
"properties": {
"pull_count": {
"description": "Defines how many messages are pulled from the queue at once.",
"type": "integer",
"default": 10
},
"pull_wait": {
"description": "Defines how long the worker waits before pulling messages from the queue again.",
"type": "string",
"pattern": "^([0-9]+(ns|us|ms|s|m|h))+$",
"default": "1s"
}
}
},
"delivery_strategy": {
"title": "Delivery Strategy",
"description": "Defines how emails will be sent, either through SMTP (default) or HTTP.",
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/code/code_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (s *Sender) SendVerificationCode(ctx context.Context, f *verification.Flow,
s.deps.Audit().
WithField("via", via).
WithField("strategy", "code").
WithSensitiveField("email_address", address).
WithSensitiveField("email_address", to).
WithField("was_notified", notifyUnknownRecipients).
Info("Address verification was requested for an unknown address.")
if !notifyUnknownRecipients {
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/link/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *Sender) SendVerificationLink(ctx context.Context, f *verification.Flow,
s.r.Audit().
WithField("via", via).
WithField("strategy", "link").
WithSensitiveField("email_address", address).
WithSensitiveField("email_address", to).
WithField("was_notified", notifyUnknownRecipients).
Info("Address verification was requested for an unknown address.")
if !notifyUnknownRecipients {
Expand Down

0 comments on commit 737cf57

Please sign in to comment.