Skip to content

Commit

Permalink
Added replace certificate option to SAML certificate section
Browse files Browse the repository at this point in the history
  • Loading branch information
Minoli de Silva committed Jun 21, 2021
1 parent c666807 commit 931c378
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ import isEmpty from "lodash-es/isEmpty";
import React, { FormEvent, FunctionComponent, MouseEvent, ReactElement, useEffect, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import {CheckboxProps, Grid, Icon} from "semantic-ui-react";
import {
AppState,
ConfigReducerStateInterface,
getEmptyPlaceholderIllustrations
} from "../../../core";
import { CheckboxProps, Grid, Icon } from "semantic-ui-react";
import { IdpCertificates } from "./idp-certificates";
import { AppState, ConfigReducerStateInterface, getEmptyPlaceholderIllustrations } from "../../../core";
import {
getFederatedAuthenticatorDetails,
Expand Down Expand Up @@ -67,7 +62,6 @@ import {
handleGetIDPTemplateListError
} from "../utils";
import { AuthenticatorCreateWizard } from "../wizards/authenticator-create-wizard";
import { IdpCertificates } from "./idp-certificates";

/**
* Proptypes for the identity providers settings component.
Expand Down Expand Up @@ -127,7 +121,7 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
const [ showAddAuthenticatorWizard, setShowAddAuthenticatorWizard ] = useState<boolean>(false);
const [ isTemplatesLoading, setIsTemplatesLoading ] = useState<boolean>(false);
const [ isPageLoading, setIsPageLoading ] = useState<boolean>(true);
const [ isJwksDisabled, setIsJwksDisabled ] = useState<boolean>(false);
const [ isSaml, setIsSaml ] = useState<boolean>(false);
const config: ConfigReducerStateInterface = useSelector((state: AppState) => state.config);

/**
Expand Down Expand Up @@ -264,7 +258,7 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
useEffect(() => {
if (identityProvider.federatedAuthenticators.defaultAuthenticatorId ==
IdentityProviderManagementConstants.SAML_AUTHENTICATOR_ID) {
setIsJwksDisabled(true);
setIsSaml(true);
}
}, [identityProvider]);

Expand Down Expand Up @@ -571,7 +565,7 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
<IdpCertificates
editingIDP={ identityProvider }
onUpdate={ onUpdate }
disableJwks={ isJwksDisabled }
isSaml={ isSaml }
/>
</Grid.Column>
</Grid.Row>
Expand Down Expand Up @@ -647,7 +641,7 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
});

//Temporarily removed until sub attributes are available
removeElementFromProps(authenticator.meta.properties, "IsUserIdInClaims" )
removeElementFromProps(authenticator.meta.properties, "IsUserIdInClaims" );

// Inject logout url
const logoutUrlData = {
Expand Down Expand Up @@ -676,15 +670,15 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
// Remove additional query params
authenticator.meta.properties.map(prop => {
if (prop.key === "SPEntityId") {
prop.displayName = "Service provider entity ID"
prop.displayName = "Service provider entity ID";
} else if (prop.key === "IdPEntityId") {
prop.displayName = "Identity provider entity ID"
prop.displayName = "Identity provider entity ID";
} else if (prop.key === "ISAuthnReqSigned") {
prop.displayName = "Enable authentication request signing";
prop.description = "Specify whether the SAML authentication request to" +
" the external identity provider must be signed or not.";
} else if (prop.key === "IsLogoutEnabled") {
prop.displayName = "Identity provider logout enabled"
prop.displayName = "Identity provider logout enabled";
prop.description = "Specify whether logout is supported by the external identity provider.";
} else if (prop.key === "IsSLORequestAccepted") {
prop.displayName = "Accept identity provider logout request";
Expand All @@ -695,17 +689,17 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
// TODO: once we refactor out the SAML authenticator setting to a
// separate component. We need to format the SSO URL to a
// code block.
prop.description = `Enter the identity provider's logout URL value` +
prop.description = "Enter the identity provider's logout URL value" +
` if it is different from the SSO URL${ssoUrl?.value ? " (" + ssoUrl.value + ")" : ""}`;
} else if (prop.key === "IsLogoutReqSigned") {
prop.displayName = "Enable logout request signing"
prop.displayName = "Enable logout request signing";
} else if (prop.key === "IsAuthnRespSigned") {
prop.displayName = "Verify response signature";
} else if (prop.key === "SignatureAlgorithm") {
prop.displayName = "Signature algorithm";
prop.description = undefined;
} else if (prop.key === "DigestAlgorithm") {
prop.displayName = "Digest algorithm"
prop.displayName = "Digest algorithm";
prop.description = undefined;
} else if (prop.key === "IncludeProtocolBinding") {
prop.displayName = "Include ProtocolBinding in the request";
Expand All @@ -720,7 +714,7 @@ export const AuthenticatorSettings: FunctionComponent<IdentityProviderSettingsPr
"as the User Identifier, you can uncheck this option " +
"and configure the subject from the Attributes section.";
} else if (prop.key === "RequestMethod") {
prop.displayName = "HTTP binding"
prop.displayName = "HTTP binding";
} else if (prop.key === "commonAuthQueryParams") {
prop.displayName = "Additional query parameters";
prop.description = "These will be sent to external IdP as query parameters" +
Expand Down
Loading

0 comments on commit 931c378

Please sign in to comment.