authentication.graphql 3.2 KB

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