Skip to content

Commit

Permalink
Merge pull request ory#14 from vivshankar/fix-device-flow-code-gen
Browse files Browse the repository at this point in the history
fix: user code error handling
  • Loading branch information
vivshankar authored Feb 17, 2024
2 parents 1bdc573 + 7e26361 commit 4ef0582
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions handler/rfc8628/strategy_hmacsha.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func (h *DefaultDeviceStrategy) GenerateUserCode(ctx context.Context) (token str
return "", "", err
}
userCode := string(seq)
signUserCode, signErr := h.UserCodeSignature(ctx, userCode)
if signErr != nil {
signUserCode, err := h.UserCodeSignature(ctx, userCode)
if err != nil {
return "", "", err
}
return userCode, signUserCode, nil
Expand Down
7 changes: 2 additions & 5 deletions storage/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ package storage
import (
"context"
"errors"
"sync"
"testing"

"github.com/ory/fosite"
)

func TestMemoryStore_Authenticate(t *testing.T) {
type fields struct {
Users map[string]MemoryUserRelation
usersMutex sync.RWMutex
Users map[string]MemoryUserRelation
}
type args struct {
in0 context.Context
Expand Down Expand Up @@ -49,8 +47,7 @@ func TestMemoryStore_Authenticate(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &MemoryStore{
Users: tt.fields.Users,
usersMutex: tt.fields.usersMutex,
Users: tt.fields.Users,
}
if err := s.Authenticate(tt.args.in0, tt.args.name, tt.args.secret); err == nil || !errors.Is(err, tt.wantErr) {
t.Errorf("Authenticate() error = %v, wantErr %v", err, tt.wantErr)
Expand Down

0 comments on commit 4ef0582

Please sign in to comment.