internal: fix nil pointer reference

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-07-01 17:02:53 +02:00
parent c72d56d02d
commit eb633c607e
2 changed files with 6 additions and 7 deletions

View File

@ -113,13 +113,13 @@ func (fe *FlowExecutor) CheckApplicationAccess(appSlug string) (bool, error) {
acsp := sentry.StartSpan(fe.Context, "authentik.outposts.flow_executor.check_access")
defer acsp.Finish()
p, _, err := fe.api.CoreApi.CoreApplicationsCheckAccessRetrieve(acsp.Context(), appSlug).Execute()
if err != nil {
return false, fmt.Errorf("failed to check access: %w", err)
}
if !p.Passing {
fe.log.Info("Access denied for user")
return false, nil
}
if err != nil {
return false, fmt.Errorf("failed to check access: %w", err)
}
fe.log.Debug("User has access")
return true, nil
}