authentication.graphql 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. # ===============================================
  2. # AUTHENTICATION
  3. # ===============================================
  4. extend type Query {
  5. apiKeys: [AuthenticationApiKey]
  6. apiState: Boolean
  7. authStrategies: [AuthenticationStrategy]
  8. authActiveStrategies(
  9. enabledOnly: Boolean
  10. ): [AuthenticationActiveStrategy]
  11. authSiteStrategies(
  12. siteId: UUID!
  13. visibleOnly: Boolean
  14. ): [AuthenticationSiteStrategy]
  15. }
  16. extend type Mutation {
  17. createApiKey(
  18. name: String!
  19. expiration: String!
  20. groups: [UUID]!
  21. ): AuthenticationCreateApiKeyResponse
  22. login(
  23. username: String!
  24. password: String!
  25. strategyId: UUID!
  26. siteId: UUID!
  27. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  28. loginTFA(
  29. continuationToken: String!
  30. securityCode: String!
  31. strategyId: UUID!
  32. siteId: UUID!
  33. setup: Boolean
  34. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  35. setupTFA(
  36. strategyId: UUID!
  37. siteId: UUID!
  38. ): AuthenticationSetupTFAResponse
  39. deactivateTFA(
  40. strategyId: UUID!
  41. ): DefaultResponse
  42. setupPasskey(
  43. siteId: UUID!
  44. ): AuthenticationSetupPasskeyResponse
  45. finalizePasskey(
  46. registrationResponse: JSON!
  47. name: String!
  48. ): DefaultResponse
  49. deactivatePasskey(
  50. id: UUID!
  51. ): DefaultResponse
  52. authenticatePasskeyGenerate(
  53. email: String!
  54. siteId: UUID!
  55. ): AuthenticationPasskeyResponse @rateLimit(limit: 5, duration: 60)
  56. authenticatePasskeyVerify(
  57. authResponse: JSON!
  58. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  59. changePassword(
  60. continuationToken: String
  61. currentPassword: String
  62. newPassword: String!
  63. strategyId: UUID!
  64. siteId: UUID!
  65. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  66. forgotPassword(
  67. email: String!
  68. ): DefaultResponse @rateLimit(limit: 3, duration: 60)
  69. register(
  70. email: String!
  71. password: String!
  72. name: String!
  73. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  74. refreshToken(
  75. token: String!
  76. ): AuthenticationTokenResponse @rateLimit(limit: 30, duration: 60)
  77. revokeApiKey(
  78. id: UUID!
  79. ): DefaultResponse
  80. setApiState(
  81. enabled: Boolean!
  82. ): DefaultResponse
  83. updateAuthStrategies(
  84. strategies: [AuthenticationStrategyInput]!
  85. ): DefaultResponse
  86. regenerateCertificates: DefaultResponse
  87. resetGuestUser: DefaultResponse
  88. }
  89. # -----------------------------------------------
  90. # TYPES
  91. # -----------------------------------------------
  92. type AuthenticationStrategy {
  93. key: String
  94. props: JSON
  95. refs: JSON
  96. title: String
  97. description: String
  98. isAvailable: Boolean
  99. useForm: Boolean
  100. usernameType: String
  101. logo: String
  102. color: String
  103. vendor: String
  104. website: String
  105. icon: String
  106. }
  107. type AuthenticationActiveStrategy {
  108. id: UUID
  109. strategy: AuthenticationStrategy
  110. displayName: String
  111. isEnabled: Boolean
  112. config: JSON
  113. registration: Boolean
  114. allowedEmailRegex: String
  115. autoEnrollGroups: [UUID]
  116. }
  117. type AuthenticationSiteStrategy {
  118. id: UUID
  119. activeStrategy: AuthenticationActiveStrategy
  120. isVisible: Boolean
  121. }
  122. type AuthenticationAuthResponse {
  123. operation: Operation
  124. jwt: String
  125. nextAction: AuthenticationNextAction
  126. continuationToken: String
  127. redirect: String
  128. tfaQRImage: String
  129. }
  130. type AuthenticationTokenResponse {
  131. operation: Operation
  132. jwt: String
  133. }
  134. type AuthenticationSetupTFAResponse {
  135. operation: Operation
  136. continuationToken: String
  137. tfaQRImage: String
  138. }
  139. type AuthenticationSetupPasskeyResponse {
  140. operation: Operation
  141. registrationOptions: JSON
  142. }
  143. type AuthenticationPasskeyResponse {
  144. operation: Operation
  145. authOptions: JSON
  146. }
  147. input AuthenticationStrategyInput {
  148. key: String!
  149. strategyKey: String!
  150. config: JSON!
  151. displayName: String!
  152. order: Int!
  153. isEnabled: Boolean!
  154. registration: Boolean!
  155. allowedEmailRegex: String!
  156. autoEnrollGroups: [UUID]!
  157. }
  158. type AuthenticationApiKey {
  159. id: UUID
  160. name: String
  161. keyShort: String
  162. expiration: Date
  163. createdAt: Date
  164. updatedAt: Date
  165. isRevoked: Boolean
  166. }
  167. type AuthenticationCreateApiKeyResponse {
  168. operation: Operation
  169. key: String
  170. }
  171. enum AuthenticationNextAction {
  172. changePassword
  173. setupTfa
  174. provideTfa
  175. redirect
  176. }