authentication.graphql 3.2 KB

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