-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add SAML post and test endpoints (#5595)
* consolidate SSO settings * update saml settings * fix type error * limit user changes when saml is enabled * add test * add toggle endpoint and fetch metadata * rename enabled param * add handling of POST saml login request * add config test endpoint
- Loading branch information
1 parent
b517959
commit 523fa71
Showing
8 changed files
with
226 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
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 @@ | ||
export type SamlLoginBinding = 'post' | 'redirect'; |
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
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 |
---|---|---|
@@ -1,8 +1,29 @@ | ||
import type { SamlAttributeMapping } from './samlAttributeMapping'; | ||
import { IsBoolean, IsObject, IsOptional, IsString } from 'class-validator'; | ||
import { SamlLoginBinding } from '.'; | ||
import { SamlAttributeMapping } from './samlAttributeMapping'; | ||
|
||
export interface SamlPreferences { | ||
mapping: SamlAttributeMapping; | ||
metadata: string; | ||
loginEnabled: boolean; | ||
loginLabel: string; | ||
export class SamlPreferences { | ||
@IsObject() | ||
@IsOptional() | ||
mapping?: SamlAttributeMapping; | ||
|
||
@IsString() | ||
@IsOptional() | ||
metadata?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
metadataUrl?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
loginBinding?: SamlLoginBinding = 'redirect'; | ||
|
||
@IsBoolean() | ||
@IsOptional() | ||
loginEnabled?: boolean; | ||
|
||
@IsString() | ||
@IsOptional() | ||
loginLabel?: string; | ||
} |
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,15 @@ | ||
import type { PostBindingContext } from 'samlify/types/src/entity'; | ||
|
||
export function getInitSSOFormView(context: PostBindingContext): string { | ||
return ` | ||
<form id="saml-form" method="post" action="${context.entityEndpoint}" autocomplete="off"> | ||
<input type="hidden" name="${context.type}" value="${context.context}" /> | ||
${context.relayState ? '<input type="hidden" name="RelayState" value="{{relayState}}" />' : ''} | ||
</form> | ||
<script type="text/javascript"> | ||
// Automatic form submission | ||
(function(){ | ||
document.forms[0].submit(); | ||
})(); | ||
</script>`; | ||
} |
Oops, something went wrong.