authentication.graphql 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. deactivateTFA(
  36. strategyId: UUID!
  37. ): DefaultResponse
  38. changePassword(
  39. continuationToken: String
  40. currentPassword: String
  41. newPassword: String!
  42. strategyId: UUID!
  43. siteId: UUID!
  44. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  45. forgotPassword(
  46. email: String!
  47. ): DefaultResponse @rateLimit(limit: 3, duration: 60)
  48. register(
  49. email: String!
  50. password: String!
  51. name: String!
  52. ): AuthenticationAuthResponse @rateLimit(limit: 5, duration: 60)
  53. refreshToken(
  54. token: String!
  55. ): AuthenticationTokenResponse @rateLimit(limit: 30, duration: 60)
  56. revokeApiKey(
  57. id: UUID!
  58. ): DefaultResponse
  59. setApiState(
  60. enabled: Boolean!
  61. ): DefaultResponse
  62. updateAuthStrategies(
  63. strategies: [AuthenticationStrategyInput]!
  64. ): DefaultResponse
  65. regenerateCertificates: DefaultResponse
  66. resetGuestUser: DefaultResponse
  67. }
  68. # -----------------------------------------------
  69. # TYPES
  70. # -----------------------------------------------
  71. type AuthenticationStrategy {
  72. key: String
  73. props: JSON
  74. refs: JSON
  75. title: String
  76. description: String
  77. isAvailable: Boolean
  78. useForm: Boolean
  79. usernameType: String
  80. logo: String
  81. color: String
  82. vendor: String
  83. website: String
  84. icon: String
  85. }
  86. type AuthenticationActiveStrategy {
  87. id: UUID
  88. strategy: AuthenticationStrategy
  89. displayName: String
  90. isEnabled: Boolean
  91. config: JSON
  92. registration: Boolean
  93. allowedEmailRegex: String
  94. autoEnrollGroups: [UUID]
  95. }
  96. type AuthenticationSiteStrategy {
  97. id: UUID
  98. activeStrategy: AuthenticationActiveStrategy
  99. isVisible: Boolean
  100. }
  101. type AuthenticationAuthResponse {
  102. operation: Operation
  103. jwt: String
  104. nextAction: AuthenticationNextAction
  105. continuationToken: String
  106. redirect: String
  107. tfaQRImage: String
  108. }
  109. type AuthenticationTokenResponse {
  110. operation: Operation
  111. jwt: String
  112. }
  113. input AuthenticationStrategyInput {
  114. key: String!
  115. strategyKey: String!
  116. config: JSON!
  117. displayName: String!
  118. order: Int!
  119. isEnabled: Boolean!
  120. registration: Boolean!
  121. allowedEmailRegex: String!
  122. autoEnrollGroups: [UUID]!
  123. }
  124. type AuthenticationApiKey {
  125. id: UUID
  126. name: String
  127. keyShort: String
  128. expiration: Date
  129. createdAt: Date
  130. updatedAt: Date
  131. isRevoked: Boolean
  132. }
  133. type AuthenticationCreateApiKeyResponse {
  134. operation: Operation
  135. key: String
  136. }
  137. enum AuthenticationNextAction {
  138. changePassword
  139. setupTfa
  140. provideTfa
  141. redirect
  142. }