2
0

authentication.graphql 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. revokeApiKey(
  50. id: UUID!
  51. ): DefaultResponse
  52. setApiState(
  53. enabled: Boolean!
  54. ): DefaultResponse
  55. updateAuthStrategies(
  56. strategies: [AuthenticationStrategyInput]!
  57. ): DefaultResponse
  58. regenerateCertificates: DefaultResponse
  59. resetGuestUser: DefaultResponse
  60. }
  61. # -----------------------------------------------
  62. # TYPES
  63. # -----------------------------------------------
  64. type AuthenticationStrategy {
  65. key: String
  66. props: JSON
  67. title: String
  68. description: String
  69. isAvailable: Boolean
  70. useForm: Boolean
  71. usernameType: String
  72. logo: String
  73. color: String
  74. vendor: String
  75. website: String
  76. icon: String
  77. }
  78. type AuthenticationActiveStrategy {
  79. id: UUID
  80. strategy: AuthenticationStrategy
  81. displayName: String
  82. isEnabled: Boolean
  83. config: JSON
  84. selfRegistration: Boolean
  85. domainWhitelist: [String]
  86. autoEnrollGroups: [Int]
  87. }
  88. type AuthenticationSiteStrategy {
  89. id: UUID
  90. activeStrategy: AuthenticationActiveStrategy
  91. order: Int
  92. isVisible: Boolean
  93. }
  94. type AuthenticationLoginResponse {
  95. operation: Operation
  96. jwt: String
  97. mustChangePwd: Boolean
  98. mustProvideTFA: Boolean
  99. mustSetupTFA: Boolean
  100. continuationToken: String
  101. redirect: String
  102. tfaQRImage: String
  103. }
  104. type AuthenticationRegisterResponse {
  105. operation: Operation
  106. jwt: String
  107. }
  108. input AuthenticationStrategyInput {
  109. key: String!
  110. strategyKey: String!
  111. config: [KeyValuePairInput]
  112. displayName: String!
  113. order: Int!
  114. isEnabled: Boolean!
  115. selfRegistration: Boolean!
  116. domainWhitelist: [String]!
  117. autoEnrollGroups: [Int]!
  118. }
  119. type AuthenticationApiKey {
  120. id: UUID
  121. name: String
  122. keyShort: String
  123. expiration: Date
  124. createdAt: Date
  125. updatedAt: Date
  126. isRevoked: Boolean
  127. }
  128. type AuthenticationCreateApiKeyResponse {
  129. operation: Operation
  130. key: String
  131. }