|
| 1 | +/** |
| 2 | + * SSO configuration types for database schema |
| 3 | + */ |
| 4 | + |
| 5 | +/** |
| 6 | + * SAML attribute mapping configuration |
| 7 | + */ |
| 8 | +export interface SamlAttributeMapping { |
| 9 | + /** |
| 10 | + * Attribute name for email in SAML Assertion |
| 11 | + * @example "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" |
| 12 | + * to get email from XML like this: |
| 13 | + * <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"> |
| 14 | + * <AttributeValue>[email protected]</AttributeValue> |
| 15 | + * </Attribute> |
| 16 | + */ |
| 17 | + email: string; |
| 18 | + |
| 19 | + /** |
| 20 | + * Attribute name for user name in SAML Assertion |
| 21 | + */ |
| 22 | + name?: string; |
| 23 | +} |
| 24 | + |
| 25 | +/** |
| 26 | + * SAML SSO configuration |
| 27 | + */ |
| 28 | +export interface SamlConfig { |
| 29 | + /** |
| 30 | + * IdP Entity ID. |
| 31 | + * Used to validate "this response is intended for Hawk" |
| 32 | + * @example "urn:hawk:tracker:saml" |
| 33 | + */ |
| 34 | + idpEntityId: string; |
| 35 | + |
| 36 | + /** |
| 37 | + * SSO URL for redirecting user to IdP |
| 38 | + * Used to redirect user to IdP for authentication |
| 39 | + * @example "https://idp.example.com/sso" |
| 40 | + */ |
| 41 | + ssoUrl: string; |
| 42 | + |
| 43 | + /** |
| 44 | + * X.509 certificate for signature verification |
| 45 | + * @example "-----BEGIN CERTIFICATE-----\nMIIDYjCCAkqgAwIBAgI...END CERTIFICATE-----" |
| 46 | + */ |
| 47 | + x509Cert: string; |
| 48 | + |
| 49 | + /** |
| 50 | + * Desired NameID format |
| 51 | + * @example "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" |
| 52 | + */ |
| 53 | + nameIdFormat?: string; |
| 54 | + |
| 55 | + /** |
| 56 | + * Attribute mapping configuration |
| 57 | + * Used to extract user attributes from SAML Response |
| 58 | + */ |
| 59 | + attributeMapping: SamlAttributeMapping; |
| 60 | +} |
| 61 | + |
| 62 | +/** |
| 63 | + * SSO configuration for workspace |
| 64 | + */ |
| 65 | +export interface WorkspaceSsoConfig { |
| 66 | + /** |
| 67 | + * Is SSO enabled |
| 68 | + */ |
| 69 | + enabled: boolean; |
| 70 | + |
| 71 | + /** |
| 72 | + * Is SSO enforced (only SSO login allowed) |
| 73 | + * If true, login via email/password is not allowed |
| 74 | + */ |
| 75 | + enforced: boolean; |
| 76 | + |
| 77 | + /** |
| 78 | + * SSO provider type |
| 79 | + * Currently only SAML is supported. In future we can add other providers (OAuth 2, etc.) |
| 80 | + */ |
| 81 | + type: 'saml'; |
| 82 | + |
| 83 | + /** |
| 84 | + * SAML-specific configuration. |
| 85 | + * Got from IdP metadata. |
| 86 | + */ |
| 87 | + saml: SamlConfig; |
| 88 | +} |
0 commit comments