fix(targets): Support authorize session request with target name (#3252)

For requests to the target authorize session endpoint we support passing
a target name instead of an id. This means that `req.GetId()` might not
be the target's public id. Since the first thing authorize session does
includes retrieving the target as part of the authorization checks, this
subtype check can leverage the public id of the target instead of using
the request.

Fixes: 6178dd516e
pull/3254/head
Timothy Messier 3 years ago committed by GitHub
parent 4e5c3d6a5d
commit f64f03ed46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -970,7 +970,7 @@ func (s Service) AuthorizeSession(ctx context.Context, req *pbs.AuthorizeSession
}
}()
subtype := target.SubtypeFromId(req.GetId())
subtype := target.SubtypeFromId(t.GetPublicId())
subtypeEntry, err := subtypeRegistry.get(subtype)
if err != nil {
return nil, errors.Wrap(ctx, err, op)

Loading…
Cancel
Save