Skip to content

Use a constant for the SignUp authentication URL - #10078

Open
Magnus Hartvig Grønbech (Groenbech96) wants to merge 5 commits into
mainfrom
edoc/signup-auth-url-constant
Open

Use a constant for the SignUp authentication URL#10078
Magnus Hartvig Grønbech (Groenbech96) wants to merge 5 commits into
mainfrom
edoc/signup-auth-url-constant

Conversation

@Groenbech96

@Groenbech96 Magnus Hartvig Grønbech (Groenbech96) commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Resolves the SignUp token endpoint from a constant in codeunit 6442 SignUp Authentication instead of reading it from the setup table.

Changes

  • Adds GetAuthUrl(EntraTenantId), which formats the existing AuthURLTxt label for the given tenant.
  • GetAccessToken now builds the request URI from GetAuthUrl() rather than from the Authentication URL field of table 6440 SignUp Connection Setup.
  • Drops the corresponding assignment from IntegrationHelpers.SetCommonConnectionSetup, since the field is no longer read. The test HTTP handlers match the token endpoint on a pattern that the constant satisfies, so the mocked responses are unaffected.

The endpoint is a fixed Microsoft Entra URL that is the same for every tenant, so there is no reason to keep it as configurable data. Keeping it in code makes the value consistent across environments and removes a setup step from onboarding.

Notes

  • The Authentication URL field is left in place for compatibility; it is simply no longer read.

AB#646373

Add GetAuthUrl and GetSandboxAuthUrl to codeunit 6442 SignUp Authentication and resolve the token endpoint through them, instead of reading the Authentication URL field from table 6440 SignUp Connection Setup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
@Groenbech96 Magnus Hartvig Grønbech (Groenbech96) changed the title Use constants for the SignUp authentication URL Use a constant for the SignUp authentication URL Aug 10, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Data\ Modeling\ /\ UI}$

GetAccessToken now calls the new GetAuthUrl() procedure, which unconditionally returns the hardcoded label constant AuthURLTxt instead of reading SignUpConnectionSetup."Authentication URL". That field remains a table field (SignUpConnectionSetup.Table.al field 2) that is still shown and editable on the SignUp Connection Setup Card page (field("Authentication URL"; Rec."Authentication URL") at SignUpConnectionSetupCard.Page.al:111) with tooltip 'Specifies the URL to connect Microsoft Entra.' After this change, editing that field has zero runtime effect: authentication always targets the hardcoded production Entra endpoint regardless of what is stored/displayed. This is a correctness/config-integrity regression distinct from (and compounding) the test-mocking break reported by al-testing-review: an admin or support engineer troubleshooting via that visible field will be misled into believing they can redirect the endpoint when they cannot. Either GetAuthUrl() should read from SignUpConnectionSetup."Authentication URL" (falling back to the constant only if blank), or the field/page control should be removed/marked read-only-informational so the UI doesn't advertise a capability that no longer exists.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

procedure GetAuthUrl(): Text
begin
    this.SignUpConnectionSetup.Get();
    if this.SignUpConnectionSetup."Authentication URL" <> '' then
        exit(this.SignUpConnectionSetup."Authentication URL");
    exit(this.AuthURLTxt);
end;

Agent judgement — not directly backed by a BCQuality knowledge article.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

GetAccessToken now ignores SignUpConnectionSetup."Authentication URL" and always posts to the hardcoded Entra endpoint. That breaks the existing test hook in test/src/IntegrationHelpers.Codeunit.al:SetCommonConnectionSetup(), which sets the field to a localhost mock URL so token requests can be redirected during isolated tests. Restore the setup-backed URL lookup here, or have GetAuthUrl() read the setup value, so the test helper remains effective.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

Clear(AccessToken);
this.SignUpConnectionSetup.Get();
this.SignUpConnectionSetup.TestField("Authentication URL");

HttpRequestMessage := this.PrepareRequest(SecretStrSubstNo(this.AuthTemplateTxt, TypeHelper.UriEscapeDataString(ClientId), ClientSecret, TypeHelper.UriEscapeDataString(ClientId)),
                                          StrSubstNo(this.SignUpConnectionSetup."Authentication URL", ClientTenant));

Agent judgement — not directly backed by a BCQuality knowledge article.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

Comment thread src/Apps/W1/EDocumentConnectors/SignUp/app/src/SignUpAuthentication.Codeunit.al Outdated
Comment thread src/Apps/W1/EDocumentConnectors/SignUp/app/src/SignUpAuthentication.Codeunit.al Outdated
Comment thread src/Apps/W1/EDocumentConnectors/SignUp/app/src/SignUpAuthentication.Codeunit.al Outdated
Comment thread src/Apps/W1/EDocumentConnectors/SignUp/app/src/SignUpAuthentication.Codeunit.al Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants