Skip to content

Commit 7f1abc3

Browse files
authored
Merge pull request #121 from Sakeeb91/issue/119-remove-null-check
Remove redundant null checks in AuthenticationManager
2 parents 57fddf1 + d227260 commit 7f1abc3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/FlowCtl.Infrastructure/Services/Authentication/AuthenticationManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ public AuthenticationData LoginBearer(string token)
6060
if (data.Username != null)
6161
data.Username = _protector.Unprotect(data.Username);
6262

63-
if (data?.Type == AuthenticationType.Basic && data.Password != null)
63+
// data is guaranteed non-null within this scope, so we can evaluate authentication type directly.
64+
if (data.Type == AuthenticationType.Basic && data.Password != null)
6465
data.Password = _protector.Unprotect(data.Password);
65-
66-
if (data?.Type == AuthenticationType.Bearer && data.AccessToken != null)
66+
67+
if (data.Type == AuthenticationType.Bearer && data.AccessToken != null)
6768
data.AccessToken = _protector.Unprotect(data.AccessToken);
6869
}
6970

0 commit comments

Comments
 (0)