Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not also support differences in environments;-) #15

Open
KjetilSmith opened this issue May 6, 2020 · 4 comments
Open

Why not also support differences in environments;-) #15

KjetilSmith opened this issue May 6, 2020 · 4 comments

Comments

@KjetilSmith
Copy link

Just as:
DiffEnvironment

So you can easy have some differences in eg. dev, test and production environment. Just have to check some of the code before.....

@nevseev
Copy link
Contributor

nevseev commented May 6, 2020

Not sure if I understood your question right, but you can configure multiple environments in the a--settings.json file. The details are in the documentation

@KjetilSmith
Copy link
Author

KjetilSmith commented May 6, 2020

One example might be if you do have a provider you want to test out in test before you deploy to production you can easy make changes to your base file:

<!-- START_B2C_Test -->
<!-- BankId Start-->
<ClaimsProvider>
  <Domain>{Settings:BankIdDomain}</Domain>
  <DisplayName>{Settings:BankIdDisplayName}</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="BID-BankId-OIDC-Base">
      <DisplayName>{Settings:BankIdDisplayName}</DisplayName>
      <Description>Login with your account</Description>
      <Protocol Name="OpenIdConnect" />
      ...
      <Metadata>
        <Item Key="METADATA">{Settings:BankIdMetaData}</Item>
        <Item Key="ProviderName">{Settings:BankIdProviderName}</Item>
        <Item Key="client_id">{Settings:BankIdClientId}</Item>
    ...
      </Metadata>
      <CryptographicKeys>
        <Key Id="client_secret" StorageReferenceId="{Settings:BankIdClientSecret}" />
      </CryptographicKeys>
      <InputClaims>..</InputClaims>
    </TechnicalProfile>
    <TechnicalProfile Id="BID-BankId-OIDC">
      <OutputClaims>	
        <OutputClaim ClaimTypeReferenceId="idpGender" PartnerClaimType="" DefaultValue="" />
    ...
      </OutputClaims>
      ...
      <OutputClaimsTransformations>
        <OutputClaimsTransformation ReferenceId="Create.." />
        ...
      </OutputClaimsTransformations>
      <IncludeTechnicalProfile ReferenceId="BID-BankId-OIDC-Base" />
      <UseTechnicalProfileForSessionManagement ReferenceId="..." />
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>
<!-- BankId Stop -->
<!-- STOP_B2C_Test -->

Further down in the document:

<UserJourney Id="...">
    <OrchestrationStep Order="1" Type="ClaimsProviderSelection" ContentDefinitionReferenceId="api.idpselections">
      <ClaimsProviderSelections>
        <ClaimsProviderSelection TargetClaimsExchangeId="..." />
        <!-- START_B2C_Test  -->
        <ClaimsProviderSelection TargetClaimsExchangeId="BankIdExchange" />
        <!-- STOP_B2C_Test -->
      </ClaimsProviderSelections>
    </OrchestrationStep>
    <OrchestrationStep Order="2" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="..Exchange" TechnicalProfileReferenceId="..." />
        <!-- START_B2C_Test  -->
        <ClaimsExchange Id="BankIdExchange" TechnicalProfileReferenceId="BID-BankId-OIDC" />
        <!-- STOP_B2C_Test -->
      </ClaimsExchanges>
    </OrchestrationStep>
    ...
</UserJourneys>

When you build the environment for 'Test' you keep the elements, but remove it in all other environments (..). Just a nice feature to add and it's different to 'appsettings.json';-)

@nevseev
Copy link
Contributor

nevseev commented May 6, 2020

I either still don't understand what exactly you're trying to do or ...why can't you just specify your TargetClaimsExchangeId in the settings?

In addition, IMO, removing or adding elements from the file based on the environment makes it very prone to mistakes

@RossBarnie
Copy link

RossBarnie commented Nov 23, 2020

One use case I'd have for this is that in a Development/Testin environment I want the JourneyInsights to send debug information to an Application Insights instance for a particular journey, but in production I do not want this element at all. I've worked around this by giving the debug user journey a different name and never pushing it to production.

Another use case for me would be around the UX customisation. I can specify different template URLs easily enough, but what if for client A I want a simple HTML template, no JS, but for client B I want to enable JS on the template. To do this at the moment I just have to use the JS-enabled templates all the time which seems to not be best practice.

So I would like these changes to be configurable in some way. Such as "if the custom template URL exists and JS is required, change the DataUri to the appropriate value"

      <ContentDefinition Id="api.error">
-       <LoadUri>~/tenant/templates/AzureBlue/exception.cshtml</LoadUri>
+       <LoadUri>CUSTOM_TEMPLATE_URL</LoadUri>
        <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
-       <DataUri>urn:com:microsoft:aad:b2c:elements:globalexception:1.1.0</DataUri>
+       <DataUri>urn:com:microsoft:aad:b2c:elements:contract:globalexception:1.2.0</DataUri>
        <Metadata>
          <Item Key="DisplayName">Error page</Item>
        </Metadata>
      </ContentDefinition>

EDIT: I'm actually thinking that this is perhaps outside the scope of this project as we're now talking about creating (or making use of) a templating engine like ERB, handlebars or the like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants