mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-13 10:19:07 +02:00
[client] Address review comments on PKCE session extend flow
Fail the PKCE authorization flow test on request error instead of continuing into a nil dereference, and make the godoc comments on the touched exported symbols identifier-leading full sentences.
This commit is contained in:
@@ -21,6 +21,10 @@ type Client interface {
|
||||
// is not eligible for session extension.
|
||||
ExtendAuthSession(sysInfo *system.Info, jwtToken string) (*proto.ExtendAuthSessionResponse, error)
|
||||
GetDeviceAuthorizationFlow() (*proto.DeviceAuthorizationFlow, error)
|
||||
// GetPKCEAuthorizationFlow returns the PKCE authorization flow information.
|
||||
//
|
||||
// sessionExtend marks the flow as renewing an existing peer's session rather
|
||||
// than logging one in. See PKCEAuthorizationFlowRequest.
|
||||
GetPKCEAuthorizationFlow(sessionExtend bool) (*proto.PKCEAuthorizationFlow, error)
|
||||
GetServerURL() string
|
||||
// IsHealthy returns the current connection status without blocking.
|
||||
|
||||
@@ -614,9 +614,7 @@ func Test_GetPKCEAuthorizationFlow(t *testing.T) {
|
||||
}
|
||||
|
||||
flowInfo, err := client.GetPKCEAuthorizationFlow(true)
|
||||
if err != nil {
|
||||
t.Error("error while retrieving pkce auth flow information")
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t, gotRequest.GetSessionExtend(), "session extend should reach the server")
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ func (c *GrpcClient) GetDeviceAuthorizationFlow() (*proto.DeviceAuthorizationFlo
|
||||
return flowInfoResp, nil
|
||||
}
|
||||
|
||||
// GetPKCEAuthorizationFlow returns a pkce authorization flow information.
|
||||
// GetPKCEAuthorizationFlow returns the PKCE authorization flow information.
|
||||
// It also takes care of encrypting and decrypting messages.
|
||||
//
|
||||
// sessionExtend tells the server the flow will renew an existing peer's session
|
||||
|
||||
@@ -80,6 +80,7 @@ func (m *MockClient) GetDeviceAuthorizationFlow() (*proto.DeviceAuthorizationFlo
|
||||
return m.GetDeviceAuthorizationFlowFunc()
|
||||
}
|
||||
|
||||
// GetPKCEAuthorizationFlow returns the PKCE authorization flow information.
|
||||
func (m *MockClient) GetPKCEAuthorizationFlow(sessionExtend bool) (*proto.PKCEAuthorizationFlow, error) {
|
||||
if m.GetPKCEAuthorizationFlowFunc == nil {
|
||||
return nil, nil
|
||||
|
||||
Reference in New Issue
Block a user