token = user.to_sgid(expires_in: 1.hour, for: 'reasons', constraint: 2).to_s
GlobalID::Locator.locate_signed(token, for: 'reasons', constraint: 3) == user # true
GlobalID::Locator.locate_signed does not respect additional constraints passed in on creation. How does one filter based on additional constraints?
CodePudding user response:
The constraints are still saved in the SignedGlobalID.uri
Therefore SignedGlobalID.parse(token, for: 'reasons').uri.params
will return a hash which contains all the parameters. Add flow control for deciding to retrieve the object based on this hash.