IdentityServer4-有没有办法获得对连接/令牌端点的响应的声明?

时间:2019-05-27 16:19:17

标签: c# .net-core identityserver4 openid-connect

我需要在Identityserver上的connect / token端点的响应中添加一些字段。我想补充一点。有什么办法吗?

我不想使用connect / userinfo端点,我的客户端正在使用资源所有者密码流。我只想要像这样的东西

{
    "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjcxQkQwM0MxRUFBOUM3NDc3RkEwMDhFMTY4M0VCMkI4NjQ3Mjg0QjgiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJjYjBEd2VxcHgwZF9vQWpoYUQ2eXVHUnloTGcifQ.eyJuYmYiOjE1NTg5NzMyMjAsImV4cCI6MTU1ODk3NjgyMCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo1NTgzOSIsImF1ZCI6WyJodHRwOi8vbG9jYWxob3N0OjU1ODM5L3Jlc291cmNlcyIsImFwaSJdLCJjbGllbnRfaWQiOiJyZWFscGxhemEuYnVkZ2V0Iiwic3ViIjoiamFpci50YXNheWNvQHJlYWxwbGF6YS5jb20ucGUiLCJhdXRoX3RpbWUiOjE1NTg5NzMyMjAsImlkcCI6ImxvY2FsIiwiZ2l2ZW5fbmFtZSI6IkpBSVIgQU5UT05JTyIsInVzZXJfbmFtZXMiOiJKQUlSIEFOVE9OSU8iLCJ1c2VyX2xhc3RuYW1lIjoiVEFTQVlDTyIsInVzZXJfbW90aGVyX2xhc3RuYW1lIjoiQkFVVElTVEEiLCJ1c2VyX3R5cGUiOiIyIiwidXNlcl9kb2N1bWVudF9udW1iZXIiOiI0NzEwMzMwMyIsImNvZGlnb191bmljbyI6IjQyNSIsInVzZXJfcmVkIjoiUlAwNjg5Iiwic2NvcGUiOlsiYXBpIl0sImFtciI6WyJBdXRlbnRpY2FkbyJdfQ.twCgMlcOTDsaBnwmxy_kNLHVE0vtMYA_bqAjIGjatTmkLPz7ozWltoMfrlw6XUmHtre3TAcMkkoUr7Ak7qWpAiWrcuvNVgHTyfKqSjloG18KyySrhW6qFSfOdtkcNuf7bhWsJYvtiZpdzRv70xC1XrGo8Vx9hhUEQxQVDa03kQdCkeCz_EgMnmQ5JL21lUM80GS3FikZHZ2UVRXdjXkFTARM7FOb6wKnasUyIPxSGfgFKgJmjYqhpjED8gSgmo2So_qc9gpc9f8nlQlTFhuulgJO_cOioOpDE8ywHpxXyjx5dbYp4JQ0hxRjtNTyyA7oA25YMwvNBpYIMzmvqyjDTQ",
    "expires_in": 3600,
    "token_type": "Bearer"
, "claim_1": "XXXXXX", "claim_2" : "SSSSSS" }

1 个答案:

答案 0 :(得分:2)

您可以按照以下方式实现ICustomTokenRequestValidator

class InitTables < ActiveRecord::Migration[5.2]
  def change
    create_table :services do |t|
      t.string :public_id, null: false, index: { unique: true }
      t.json :details
    end
  end
end

,然后在启动时:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json'