oauth2_pocketid.adoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [#oauth2-pocketid]
  2. = OAuth2 - Pocket ID
  3. OliveTin has been tested with Pocket ID. This documentation page describes how to configure Pocket ID for use with OliveTin and assumes you already have Pocket ID installed and running. It allows guests access to some actions, and admins access to all actions.
  4. This example uses Pocket ID v2.19.2. Please check the Pocket ID docs if you are running a newer version.
  5. == Pocket ID Configuration:
  6. ==== Create a new user group:
  7. Assign users to this group that will have access to all olivetin actions. We will add a custom claim that is sent to Olivetin at login. +
  8. -> Administration -> User Groups -> Add Group +
  9. [cols="1,2"]
  10. |===
  11. | Name | `olivetin_admins`
  12. | Friendly Name | `Olivetin Admins`
  13. |===
  14. -> Custom Claims
  15. [cols="1,2", options="header"]
  16. |===
  17. | Key | Value
  18. | olivetin_group
  19. | olivetin_admin
  20. |===
  21. ==== Create a new client:
  22. -> Administration -> OIDC Clients -> Add OIDC Client +
  23. [cols="1,2"]
  24. |===
  25. | Name | `Olivetin`
  26. | Client Type | Confidential Client
  27. |===
  28. -> Callback URLs -> + Add callback URL +
  29. [cols="1,1"]
  30. |===
  31. | Callback URLs | `\https://olivetin.example.com/oauth/callback`
  32. |===
  33. -> Create
  34. -> Access Tab: +
  35. Allowed User Groups -> Selected user groups +
  36. -> `olivetin_admins` -> Save +
  37. Copy the generated Client ID and Client Secret from the General tab into olivetin's config.yaml (example below). The secret will only be displayed once.
  38. == Olivetin Configuration
  39. .config.yaml
  40. [source,yaml]
  41. ----
  42. authRequireGuestsToLogin: false
  43. defaultPermissions:
  44. view: false
  45. exec: false
  46. logs: false
  47. # showDiagnostics and showLogList default to true for everyone (including
  48. # guests), so turn them off here and enable them for admins only below.
  49. defaultPolicy:
  50. showDiagnostics: false
  51. showLogList: false
  52. accessControlLists:
  53. - name: admin
  54. permissions:
  55. view: true
  56. exec: true
  57. logs: true
  58. policy:
  59. showDiagnostics: true
  60. showLogList: true
  61. matchUsergroups:
  62. - olivetin_admin
  63. addToEveryAction: true
  64. - name: "guests"
  65. permissions:
  66. view: true
  67. exec: true
  68. logs: false
  69. matchUsernames: [ "guest" ]
  70. addToEveryAction: false
  71. authLocalUsers:
  72. enabled: false
  73. authOAuth2RedirectUrl: https://olivetin.example.com/oauth/callback
  74. authOAuth2Providers:
  75. pocket-id:
  76. name: pocket-id
  77. title: Pocket ID
  78. icon: '<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/pocket-id-light.svg"/>'
  79. authUrl: https://id.example.com/authorize
  80. tokenUrl: https://id.example.com/api/oidc/token
  81. whoamiUrl: https://id.example.com/api/oidc/userinfo
  82. clientId: "[REDACTED]"
  83. clientSecret: "[REDACTED]"
  84. scopes:
  85. - openid
  86. - profile
  87. - email
  88. usernameField: preferred_username
  89. userGroupField: olivetin_group
  90. insecureSkipVerify: true
  91. actions:
  92. - title: "Hello world!"
  93. shell: echo 'Hello World! I have guest access'
  94. acls:
  95. - "guests"
  96. - title: "Admins only"
  97. shell: echo 'Hello World! I am an admin'
  98. ----
  99. == Pocket ID config
  100. image::pocketid.png[]