mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
feat: added OIDC discovery
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
import { isNull, omitBy } from "lodash";
|
||||
|
||||
import TenantContext from "talk-server/graph/tenant/context";
|
||||
import { GQLSettingsInput } from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import {
|
||||
GQLDiscoverOIDCConfigurationInput,
|
||||
GQLOIDCConfiguration,
|
||||
GQLSettingsInput,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { Tenant } from "talk-server/models/tenant";
|
||||
import { regenerateSSOKey, update } from "talk-server/services/tenant";
|
||||
import {
|
||||
discoverOIDCConfiguration,
|
||||
regenerateSSOKey,
|
||||
update,
|
||||
} from "talk-server/services/tenant";
|
||||
|
||||
export default ({ mongo, redis, tenantCache, tenant }: TenantContext) => ({
|
||||
update: (input: GQLSettingsInput): Promise<Tenant | null> =>
|
||||
update(mongo, redis, tenantCache, tenant, omitBy(input, isNull)),
|
||||
regenerateSSOKey: (): Promise<Tenant | null> =>
|
||||
regenerateSSOKey(mongo, redis, tenantCache, tenant),
|
||||
discoverOIDCConfiguration: (
|
||||
input: GQLDiscoverOIDCConfigurationInput
|
||||
): Promise<GQLOIDCConfiguration> => discoverOIDCConfiguration(input.issuer),
|
||||
});
|
||||
|
||||
@@ -51,6 +51,10 @@ const Mutation: GQLMutationTypeResolver<void> = {
|
||||
settings: await ctx.mutators.Settings.regenerateSSOKey(),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
discoverOIDCConfiguration: async (source, { input }, ctx) => ({
|
||||
configuration: await ctx.mutators.Settings.discoverOIDCConfiguration(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
};
|
||||
|
||||
export default Mutation;
|
||||
|
||||
@@ -1900,6 +1900,41 @@ type RegenerateSSOKeyPayload {
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
##################
|
||||
## discoverOIDCConfiguration
|
||||
##################
|
||||
|
||||
input DiscoverOIDCConfigurationInput {
|
||||
"""
|
||||
|
||||
"""
|
||||
issuer: String!
|
||||
|
||||
"""
|
||||
clientMutationId is required for Relay support.
|
||||
"""
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
type OIDCConfiguration {
|
||||
authorizationURL: String
|
||||
tokenURL: String
|
||||
jwksURI: String
|
||||
}
|
||||
|
||||
type DiscoverOIDCConfigurationPayload {
|
||||
"""
|
||||
configuration was the discovered configuration for the OpenID Connect server
|
||||
given the provided issuer.
|
||||
"""
|
||||
configuration: OIDCConfiguration
|
||||
|
||||
"""
|
||||
clientMutationId is required for Relay support.
|
||||
"""
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
##################
|
||||
## Mutation
|
||||
##################
|
||||
@@ -1929,6 +1964,10 @@ type Mutation {
|
||||
regenerateSSOKey(input: RegenerateSSOKeyInput!): RegenerateSSOKeyPayload
|
||||
@auth(roles: [ADMIN])
|
||||
|
||||
discoverOIDCConfiguration(
|
||||
input: DiscoverOIDCConfigurationInput!
|
||||
): DiscoverOIDCConfigurationPayload @auth(roles: [ADMIN])
|
||||
|
||||
"""
|
||||
createCommentReaction will create a Reaction authored by the current logged in
|
||||
User on a Comment.
|
||||
|
||||
Reference in New Issue
Block a user