template.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package oidc
  15. import api "yunion.io/x/onecloud/pkg/apis/identity"
  16. var (
  17. // map[at_hash:KgtZpGvTuIaud0SVcmmkKQ aud:example-app email:kilgore@kilgore.trout email_verified:true exp:1593434672 groups:["authors"] iat:1593348272 iss:http://127.0.0.1:5556/dex name:Kilgore Trout sub:Cg0wLTM4NS0yODA4OS0wEgRtb2Nr]
  18. DexOIDCTemplate = api.SOIDCIdpConfigOptions{
  19. Scopes: []string{
  20. "openid",
  21. "email",
  22. "groups",
  23. "profile",
  24. },
  25. SIdpAttributeOptions: api.SIdpAttributeOptions{
  26. UserNameAttribute: "name",
  27. UserIdAttribute: "sub",
  28. UserEmailAttribute: "email",
  29. UserDisplaynameAttribtue: "name",
  30. },
  31. }
  32. // https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
  33. // map[avatar_url:https://avatars1.githubusercontent.com/u/1121362?v=4 bio: blog:https://yunion.io collaborators:0 company:Yunion.io created_at:2011-10-12T04:18:27Z disk_usage:925302 email: events_url:https://api.github.com/users/swordqiu/events{/privacy} followers:13 followers_url:https://api.github.com/users/swordqiu/followers following:1 following_url:https://api.github.com/users/swordqiu/following{/other_user} gists_url:https://api.github.com/users/swordqiu/gists{/gist_id} gravatar_id: hireable: html_url:https://github.com/swordqiu
  34. // id:1121362 location:Beijing, China
  35. // login:swordqiu name:Jian Qiu
  36. // node_id:MDQ6VXNlcjExMjEzNjI= organizations_url:https://api.github.com/users/swordqiu/orgs owned_private_repos:0 plan:{"name":"free","space":976562499,"collaborators":0,"private_repos":10000} private_gists:0 public_gists:0 public_repos:37 received_events_url:https://api.github.com/users/swordqiu/received_events repos_url:https://api.github.com/users/swordqiu/repos site_admin:false starred_url:https://api.github.com/users/swordqiu/starred{/owner}{/repo} subscriptions_url:https://api.github.com/users/swordqiu/subscriptions total_private_repos:0 twitter_username: two_factor_authentication:false type:User updated_at:2020-06-29T01:39:42Z url:https://api.github.com/users/swordqiu]
  37. GithubOIDCTemplate = api.SOIDCIdpConfigOptions{
  38. Scopes: []string{
  39. "user",
  40. },
  41. AuthUrl: "https://github.com/login/oauth/authorize",
  42. TokenUrl: "https://github.com/login/oauth/access_token",
  43. UserinfoUrl: "https://api.github.com/user",
  44. TimeoutSecs: 60,
  45. SIdpAttributeOptions: api.SIdpAttributeOptions{
  46. UserIdAttribute: "id",
  47. UserNameAttribute: "login",
  48. UserEmailAttribute: "email",
  49. UserDisplaynameAttribtue: "name",
  50. },
  51. }
  52. // {
  53. // "sub": "112176790568447731603",
  54. // "name": "Jian Qiu",
  55. // "given_name": "Jian",
  56. // "family_name": "Qiu",
  57. // "picture": "https://lh3.googleusercontent.com/a/AATXAJyj32UmKhmwI38ljm8xI53LX4Lw3w5wYxKsj4JS\u003ds96-c",
  58. // "email": "swordqiu@gmail.com",
  59. // "email_verified": true,
  60. // "locale": "zh-CN"
  61. // }
  62. GoogleOIDCTemplate = api.SOIDCIdpConfigOptions{
  63. Endpoint: "https://accounts.google.com",
  64. SIdpAttributeOptions: api.SIdpAttributeOptions{
  65. UserIdAttribute: "sub",
  66. UserNameAttribute: "email",
  67. UserEmailAttribute: "email",
  68. UserDisplaynameAttribtue: "name",
  69. },
  70. }
  71. AzureADTemplate = api.SOIDCIdpConfigOptions{
  72. Scopes: []string{
  73. "openid",
  74. "profile",
  75. "email",
  76. },
  77. TimeoutSecs: 60,
  78. SIdpAttributeOptions: api.SIdpAttributeOptions{
  79. UserIdAttribute: "sub",
  80. UserNameAttribute: "name",
  81. UserEmailAttribute: "email",
  82. UserDisplaynameAttribtue: "name",
  83. },
  84. }
  85. )