authentication.graphql 3.2 KB

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