Use a constant for the SignUp authentication URL - #10078
Use a constant for the SignUp authentication URL#10078Magnus Hartvig Grønbech (Groenbech96) wants to merge 5 commits into
Conversation
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
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1fd21460-4d9b-4bbb-8495-562c6ed1a3e5
|
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 |
|
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 |
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
Resolves the SignUp token endpoint from a constant in codeunit 6442
SignUp Authenticationinstead of reading it from the setup table.Changes
GetAuthUrl(EntraTenantId), which formats the existingAuthURLTxtlabel for the given tenant.GetAccessTokennow builds the request URI fromGetAuthUrl()rather than from theAuthentication URLfield of table 6440SignUp Connection Setup.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
Authentication URLfield is left in place for compatibility; it is simply no longer read.AB#646373