authentication.graphql 2.9 KB

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