authentication.graphql 3.4 KB

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