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. ): 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. domainWhitelist: [String]
  90. autoEnrollGroups: [Int]
  91. }
  92. type AuthenticationSiteStrategy {
  93. id: UUID
  94. activeStrategy: AuthenticationActiveStrategy
  95. order: Int
  96. isVisible: Boolean
  97. }
  98. type AuthenticationLoginResponse {
  99. operation: Operation
  100. jwt: String
  101. mustChangePwd: Boolean
  102. mustProvideTFA: Boolean
  103. mustSetupTFA: Boolean
  104. continuationToken: String
  105. redirect: String
  106. tfaQRImage: String
  107. }
  108. type AuthenticationRegisterResponse {
  109. operation: Operation
  110. jwt: String
  111. }
  112. type AuthenticationTokenResponse {
  113. operation: Operation
  114. jwt: String
  115. }
  116. input AuthenticationStrategyInput {
  117. key: String!
  118. strategyKey: String!
  119. config: [KeyValuePairInput]
  120. displayName: String!
  121. order: Int!
  122. isEnabled: Boolean!
  123. selfRegistration: Boolean!
  124. domainWhitelist: [String]!
  125. autoEnrollGroups: [Int]!
  126. }
  127. type AuthenticationApiKey {
  128. id: UUID
  129. name: String
  130. keyShort: String
  131. expiration: Date
  132. createdAt: Date
  133. updatedAt: Date
  134. isRevoked: Boolean
  135. }
  136. type AuthenticationCreateApiKeyResponse {
  137. operation: Operation
  138. key: String
  139. }