authentication.graphql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # ===============================================
  2. # AUTHENTICATION
  3. # ===============================================
  4. extend type Query {
  5. apiKeys: [AuthenticationApiKey]
  6. apiState: Boolean
  7. authStrategies(
  8. siteId: UUID
  9. enabledOnly: Boolean
  10. ): [AuthenticationStrategy]
  11. }
  12. extend type Mutation {
  13. createApiKey(
  14. name: String!
  15. expiration: String!
  16. fullAccess: Boolean!
  17. group: Int
  18. ): AuthenticationCreateApiKeyResponse
  19. login(
  20. username: String!
  21. password: String!
  22. strategy: String!
  23. ): AuthenticationLoginResponse @rateLimit(limit: 5, duration: 60)
  24. loginTFA(
  25. continuationToken: String!
  26. securityCode: String!
  27. setup: Boolean
  28. ): AuthenticationLoginResponse @rateLimit(limit: 5, duration: 60)
  29. loginChangePassword(
  30. continuationToken: String!
  31. newPassword: String!
  32. ): AuthenticationLoginResponse @rateLimit(limit: 5, duration: 60)
  33. forgotPassword(
  34. email: String!
  35. ): DefaultResponse @rateLimit(limit: 3, duration: 60)
  36. register(
  37. email: String!
  38. password: String!
  39. name: String!
  40. ): AuthenticationRegisterResponse
  41. revokeApiKey(
  42. id: Int!
  43. ): DefaultResponse
  44. setApiState(
  45. enabled: Boolean!
  46. ): DefaultResponse
  47. updateAuthStrategies(
  48. strategies: [AuthenticationStrategyInput]!
  49. ): DefaultResponse
  50. regenerateCertificates: DefaultResponse
  51. resetGuestUser: DefaultResponse
  52. }
  53. # -----------------------------------------------
  54. # TYPES
  55. # -----------------------------------------------
  56. type AuthenticationStrategy {
  57. key: String!
  58. props: [KeyValuePair] @auth(requires: ["manage:system"])
  59. title: String!
  60. description: String
  61. isAvailable: Boolean
  62. useForm: Boolean!
  63. usernameType: String
  64. logo: String
  65. color: String
  66. website: String
  67. icon: String
  68. }
  69. type AuthenticationActiveStrategy {
  70. key: String!
  71. strategy: AuthenticationStrategy!
  72. displayName: String!
  73. order: Int!
  74. isEnabled: Boolean!
  75. config: [KeyValuePair] @auth(requires: ["manage:system"])
  76. selfRegistration: Boolean!
  77. domainWhitelist: [String]! @auth(requires: ["manage:system"])
  78. autoEnrollGroups: [Int]! @auth(requires: ["manage:system"])
  79. }
  80. type AuthenticationLoginResponse {
  81. operation: Operation
  82. jwt: String
  83. mustChangePwd: Boolean
  84. mustProvideTFA: Boolean
  85. mustSetupTFA: Boolean
  86. continuationToken: String
  87. redirect: String
  88. tfaQRImage: String
  89. }
  90. type AuthenticationRegisterResponse {
  91. operation: Operation
  92. jwt: String
  93. }
  94. input AuthenticationStrategyInput {
  95. key: String!
  96. strategyKey: String!
  97. config: [KeyValuePairInput]
  98. displayName: String!
  99. order: Int!
  100. isEnabled: Boolean!
  101. selfRegistration: Boolean!
  102. domainWhitelist: [String]!
  103. autoEnrollGroups: [Int]!
  104. }
  105. type AuthenticationApiKey {
  106. id: Int!
  107. name: String!
  108. keyShort: String!
  109. expiration: Date!
  110. createdAt: Date!
  111. updatedAt: Date!
  112. isRevoked: Boolean!
  113. }
  114. type AuthenticationCreateApiKeyResponse {
  115. operation: Operation
  116. key: String
  117. }