authentication.graphql 2.3 KB
Newer Older
1 2 3 4
# ===============================================
# AUTHENTICATION
# ===============================================

5 6 7 8 9 10 11 12
extend type Query {
  authentication: AuthenticationQuery
}

extend type Mutation {
  authentication: AuthenticationMutation
}

13 14 15 16
# -----------------------------------------------
# QUERIES
# -----------------------------------------------

17
type AuthenticationQuery {
NGPixel's avatar
NGPixel committed
18
  strategies(
19
    isEnabled: Boolean
NGPixel's avatar
NGPixel committed
20
  ): [AuthenticationStrategy]
21 22
}

23 24 25 26
# -----------------------------------------------
# MUTATIONS
# -----------------------------------------------

27
type AuthenticationMutation {
28 29 30
  login(
    username: String!
    password: String!
NGPixel's avatar
NGPixel committed
31
    strategy: String!
32
  ): AuthenticationLoginResponse @rateLimit(limit: 5, duration: 60)
33 34 35 36

  loginTFA(
    loginToken: String!
    securityCode: String!
37
  ): DefaultResponse @rateLimit(limit: 5, duration: 60)
38

39 40 41 42 43 44
  register(
    email: String!
    password: String!
    name: String!
  ): AuthenticationRegisterResponse

45
  updateStrategies(
46 47
    strategies: [AuthenticationStrategyInput]!
    config: AuthenticationConfigInput
48
  ): DefaultResponse @auth(requires: ["manage:system"])
49 50 51

  regenerateCertificates: DefaultResponse @auth(requires: ["manage:system"])
  resetGuestUser: DefaultResponse @auth(requires: ["manage:system"])
52
}
53

54 55 56 57
# -----------------------------------------------
# TYPES
# -----------------------------------------------

NGPixel's avatar
NGPixel committed
58
type AuthenticationStrategy {
59 60 61 62
  isEnabled: Boolean!
  key: String!
  props: [String]
  title: String!
63
  description: String
64
  isAvailable: Boolean
65
  useForm: Boolean!
66
  logo: String
67
  color: String
68
  website: String
69
  icon: String
70
  config: [KeyValuePair] @auth(requires: ["manage:system"])
71
  selfRegistration: Boolean!
72 73
  domainWhitelist: [String]! @auth(requires: ["manage:system"])
  autoEnrollGroups: [Int]! @auth(requires: ["manage:system"])
74
}
75 76

type AuthenticationLoginResponse {
77
  responseResult: ResponseStatus
78
  jwt: String
79 80 81
  tfaRequired: Boolean
  tfaLoginToken: String
}
82

83 84 85 86 87
type AuthenticationRegisterResponse {
  responseResult: ResponseStatus
  jwt: String
}

88 89 90 91 92 93 94 95
input AuthenticationStrategyInput {
  isEnabled: Boolean!
  key: String!
  config: [KeyValuePairInput]
  selfRegistration: Boolean!
  domainWhitelist: [String]!
  autoEnrollGroups: [Int]!
}
96 97 98 99 100 101

input AuthenticationConfigInput {
  audience: String!
  tokenExpiration: String!
  tokenRenewal: String!
}