Rails SignedGlobalID 未过滤附加参数
Rails SignedGlobalID not filtering on additional parameters
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 不遵守创建时传递的附加约束。一个过滤器如何基于附加约束?
约束仍然保存在SignedGlobalID.uri
因此SignedGlobalID.parse(token, for: 'reasons').uri.params
将return一个包含所有参数的散列。添加流程控制以决定根据此哈希检索对象。
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 不遵守创建时传递的附加约束。一个过滤器如何基于附加约束?
约束仍然保存在SignedGlobalID.uri
因此SignedGlobalID.parse(token, for: 'reasons').uri.params
将return一个包含所有参数的散列。添加流程控制以决定根据此哈希检索对象。