-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get saml config for domain (#10618)
- Loading branch information
1 parent
2c1547b
commit 2da5af3
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/server/graphql/private/queries/getSAMLForDomain.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import getKysely from '../../../postgres/getKysely' | ||
import standardError from '../../../utils/standardError' | ||
import {QueryResolvers} from '../resolverTypes' | ||
|
||
const getSAMLForDomain: QueryResolvers['getSAMLForDomain'] = async (_parent, {domain}) => { | ||
const pg = getKysely() | ||
|
||
const samlResult = await pg | ||
.selectFrom('SAML') | ||
.innerJoin('SAMLDomain', 'SAML.id', 'SAMLDomain.samlId') | ||
.selectAll('SAML') | ||
.where('SAMLDomain.domain', '=', domain.toLowerCase()) | ||
.executeTakeFirst() | ||
|
||
if (!samlResult) { | ||
return standardError(new Error('No SAML configuration found for domain')) | ||
} | ||
return { | ||
saml: samlResult | ||
} | ||
} | ||
|
||
export default getSAMLForDomain |
4 changes: 4 additions & 0 deletions
4
packages/server/graphql/private/typeDefs/GetSAMLForDomainPayload.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
""" | ||
Return value for getSAMLForDomain, which could be an error | ||
""" | ||
union GetSAMLForDomainPayload = ErrorPayload | GetSAMLForDomainSuccess |
6 changes: 6 additions & 0 deletions
6
packages/server/graphql/private/typeDefs/GetSAMLForDomainSuccess.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type GetSAMLForDomainSuccess { | ||
""" | ||
The SAML configuration | ||
""" | ||
saml: SAML! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters