authentication.graphql 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. logo: String
  70. color: String
  71. website: String
  72. icon: String
  73. }
  74. type AuthenticationActiveStrategy {
  75. key: String!
  76. strategy: AuthenticationStrategy!
  77. displayName: String!
  78. order: Int!
  79. config: [KeyValuePair] @auth(requires: ["manage:system"])
  80. selfRegistration: Boolean!
  81. domainWhitelist: [String]! @auth(requires: ["manage:system"])
  82. autoEnrollGroups: [Int]! @auth(requires: ["manage:system"])
  83. }
  84. type AuthenticationLoginResponse {
  85. responseResult: ResponseStatus
  86. jwt: String
  87. mustChangePwd: Boolean
  88. mustProvideTFA: Boolean
  89. continuationToken: String
  90. }
  91. type AuthenticationRegisterResponse {
  92. responseResult: ResponseStatus
  93. jwt: String
  94. }
  95. input AuthenticationStrategyInput {
  96. key: String!
  97. strategyKey: String!
  98. config: [KeyValuePairInput]
  99. displayName: String!
  100. order: Int!
  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. responseResult: ResponseStatus
  116. key: String
  117. }