authentication.graphql 2.8 KB

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