Repository navigation
Conversation
maximthomas
left a comment
There was a problem hiding this comment.
praise: The implied- and explicit-consent browser scenarios check that login alone leaves the device pending and that one code submission leads to token issuance.
issue (blocking): The default verification URI no longer works with a valid child-realm session on a shared hostname.
DeviceCodeVerificationResource.java:421–425
When a child provider leaves its verification URL blank, the issued URI is the deployment's realm-less /oauth2/device/user. On the base, GET displays the form and POST loads the code and applies its stored realm before client lookup and session validation, so a user signed into the child realm can complete verification on that URI. HEAD checks the realm inferred from the shared hostname on GET and sends that user to root login. If the subsequent POST directs the browser to child login, its return URL is still the realm-less URI, where the GET rejects the child session again. Default URI construction, base GET, POST code lookup and realm attributes, login return URL
Generate a realm-qualified verification URI by default and preserve compatibility for already-issued realm-less URLs by deferring the realm check on those URLs until the code identifies the provider.
Closure criterion On a shared hostname, a signed-out visitor can verify a child-realm device via its newly issued URI with one code entry. A visitor with a valid child session can still verify through an existing realm-less URI.
issue (blocking): Pre-login skips the mapped authentication chain for a signed-out device user.
ResourceOwnerSessionValidator.java:223–228
For a code issued with acr_values mapped to a non-default chain, the base learned that value on the first POST and selected the mapped chain in the login redirect. HEAD's GET authenticates against the realm default before the code is known. On the implied-consent POST, a valid same-realm session from the default chain can be accepted with ACR 0 because setCurrentAcr records the mismatch and validation proceeds. Stored ACR, base login chain selection, HEAD ACR matching, device approval
Keep the device verification pending while the browser completes the mapped chain when the initial login does not match. Preserve the verification continuation across that login.
Closure criterion A signed-out user with a code that requests a configured non-default chain completes that chain, the approved code records the matching ACR, and the user enters the code once.
suggestion (non-blocking): Check the consent setting before reusing a device client fixture.
device-flow-test.spec.mjs:125–129
The setup reuses an existing client based on its response type. On a reused instance where the explicit-consent client's persisted isConsentImplied is true, setup succeeds and the browser waits for an Allow button that never appears. Compare the stored flag with the requested value before returning and use the existing PUT for a mismatch. Fixture setup, browser assertion
2ef2757 to
c772792
Compare
|
@maximthomas, I addressed all three findings in c772792.
All 1,012 OAuth2 module tests and all 30 device verification and PKCE Playwright scenarios passed. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The bookmark scenario checks that the mapped login keeps the device pending, restores the submitted code, and records the matching ACR in the redeemed ID token.
issue (blocking): Stop repeating the mapped login when a custom login template keeps returning the default chain.
ResourceOwnerSessionValidator.java:229–238
With implied consent and a custom login template that forwards only goto, a signed-out user can get a valid session from the default chain and submit a code requesting a different mapped chain. Each POST now requires that chain, but the custom login builder renders the same login target without selecting it. The return GET accepts the same-realm session and shows the confirmation again. The previous revision approved the device with an unmatched ACR of 0. On HEAD the device remains pending until expiry. Custom-template test · POST guard · Login URL builders · Return GET · Previous approval path
Preserve the mapped-ACR requirement and track whether the server-side continuation already requested the mapped login. If the returned session still lacks the chain, show an actionable error. Custom login integrations that can satisfy the mapped ACR should complete the existing confirmation flow.
Closure criterion A custom login that returns the default chain never sends the user through repeated login and confirmation. When it returns the mapped chain, the browser completes authorization with one code entry, the same CSRF-protected confirmation, and the matching ACR.
|
@maximthomas, I fixed the custom login loop in 9d17593. OpenAM remembers which ACR it requested for the submitted device code and checks the session as soon as the browser returns. If the custom login page returns the default chain again, the browser shows the required authentication method and the device stays pending. I reproduced the repeated confirmation on the previous revision with a template that forwards only All 1,012 OAuth2 module tests and all 32 device verification and PKCE browser scenarios passed. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The custom-login browser tests check pending state on both return paths and verify the ID token ACR after successful confirmation.
suggestion (non-blocking): Preserve a pending confirmation when the user signs in again through the default chain.
DeviceCodeVerificationResource.java:189–191
After mapped login has displayed the confirmation, a sign-out and default-chain sign-in in another tab can replace the SSO session while the servlet continuation and form CSRF token remain valid. On the previous revision, submitting the open form offered mapped login again. The current POST returns access_denied and asks the user to restart. A separate follow-up could let this POST request a fresh mapped login and keep the terminal check on its return GET. Previous POST · Current mismatch handling
Follow-up priority Low
9d17593 to
595d1b0
Compare
|
@maximthomas, I addressed the session replacement case in 595d1b0. If the user signs out and signs back in through the default chain in another tab, submitting the open confirmation form now requests the mapped chain with The two-tab Playwright test returned HTTP 400 on the previous revision. It now completes with one code entry and verifies the requested |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The two-tab test checks the forced login, restored code, pending state before confirmation, and matching ACR in the redeemed ID token.
|
Thanks a lot for working through #1262. Authenticating before the user code form, and carrying the realm and ACR across the login, are both really nice improvements. I found one thing I'd like fixed before merging, plus two related points. Blocker: a stale When
It fails closed, so nothing is wrongly approved, but it is a dead end. Could the POST redirect to Suggestion: don't create an HttpSession for the code-less flow A realm-qualified GET without an SSO session now goes through Design point: the pending flow lives in the container's local HttpSession
|
595d1b0 to
91b5c81
Compare
|
@tsujiguchitky, I addressed all three points in 91b5c81.
I verified the cluster path on two OpenAM nodes sharing CTS in OpenDJ. Node A received the code, node B restored it after mapped login, and node A accepted the confirmation. The device stayed pending until confirmation, and the ID token contained the requested |
maximthomas
left a comment
There was a problem hiding this comment.
issue (blocking): Honor a provider's configured shared Verification URL on the initial submission.
DeviceCodeVerificationResource.java:183–186
A child provider can advertise a configured shared address such as /oauth2/device/user?realm=%2F. An authenticated submission through that address redeemed the child-issued code on the previous revision. HEAD returns not_found before it applies the issuing realm and redemption fails. In the browser, the initial POST from a root session also changed from a 303 to child login to a 200 with not_found. Use the code's realm on initial submissions through a configured shared URL and keep the realm and code binding on continuation requests. Verification URL setting · URL advertised to the device · Previous POST
Closure criterion A child-realm session can authorize and redeem its code through the advertised shared URL. A root session submitting a child-issued code is directed to child login.
issue (blocking): Serve the verification form over HTTPS before issuing a secure continuation cookie.
DeviceCodeVerificationResource.java:509–516
An installation can still serve a legacy HTTP verification form while its Base URL Source sends login completion to HTTPS on the same hostname. With com.iplanet.am.cookie.secure=false and Tomcat's default servlet cookie policy, the previous flow could carry JSESSIONID from the form submission to the HTTPS return on the same instance. HEAD selects __Host- and Secure from the return address, then issues that cookie on the original HTTP response. The browser discards it, and the HTTPS return opens a blank form that requires the code again. Upgrade the initial GET to HTTPS before rendering the form while preserving legacy realm selection. Previous session continuation · New response cookie · Tomcat session cookie handling · HTTP cookie storage model
Closure criterion A user who opens a legacy HTTP verification URL on a deployment with a same-host HTTPS Base URL can complete login and confirm the code after entering it once. The HTTPS continuation keeps its secure browser binding.
|
@maximthomas, I addressed both blockers in e37e854.
All 1,039 OAuth2 module tests and all 37 Playwright scenarios passed. The mixed HTTP/HTTPS scenario ran separately on the TLS-proxy setup. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The new browser cases verify that a child-realm session can redeem its code through the canonical shared address and that a root session completes child login before redemption.
issue (blocking): Preserve the advertised shared Verification URL across the first login.
DeviceCodeVerificationResource.java:529–538
A signed-out visitor opens a child provider's advertised address /oauth2/device/user?realm=%2F&ui_locales=en. The root login returns the browser to ?realm=%2F, which drops the locale and fails the new comparison against the full advertised URL. Chromium received HTTP 200 with not_found when submitting the child code from the resulting root session, and the code stayed pending. Preserve the shared address through the code-less login and compare the effective public form address against the issuing provider's configuration while retaining the realm, code and cookie checks on continuations. Initial POST · Address comparison
Chromium log and captured response state
Root login returned with configured locale: false
Initial child code submission status: 200
Expected: 303
Received: 200
errorCode: "not_found"Closure criterion A child-realm session can authorize and redeem its code through its provider's advertised shared URL. A root session submitting a child-issued code is directed to child login, including when the visitor first reached the shared URL while signed out.
Round 5 status Open. Round 5 rejected all qualified cross-realm submissions. Round 6 passes both session cases for the canonical address and still rejects the first submission after login drops the configured query parameter. Source review and an isolated Restlet comparison also showed that a configured alternate public origin fails when the route realm has a different fixed Base URL. The alternate-origin case was checked without a browser. Previous POST
issue (blocking): Preserve the code when HTTPS is configured only in the child realm.
DeviceCodeVerificationResource.java:373–381
On a shared hostname, a realm-less HTTP bookmark can select root's HTTP Base URL Source and display the code field over HTTP. Submitting a child-issued code switches the request to the child's HTTPS Base URL and sends a __Host- Secure continuation cookie on the HTTP response. Chromium discarded the cookie, so the return from child login opened the form without the submitted code and the device remained pending. Handle the transport transition before issuing the Secure cookie and cover the case where only the issuing realm uses HTTPS. Realm switch · Cookie issuance · Per-realm Base URL Source
Chromium log
Code form scheme: http:
HTTP response carried a Secure continuation cookie: true
Browser stored the continuation cookie: false
Error: HTTPS login should restore the code entered on the legacy bookmark
Expected: true
Received: false
Closure criterion A user who opens a legacy HTTP verification URL on a deployment with a same-host HTTPS Base URL can complete login and confirm the code after entering it once. The HTTPS continuation keeps its secure browser binding.
Round 5 status Open. Source review confirmed that both revisions fail with an HTTP Base URL on root and an HTTPS Base URL on the issuing child realm. The new Chromium control passed when root used the HTTPS Base URL.
|
@maximthomas, I addressed both findings in 543427b.
Both browser regressions reproduced on e37e854. All 1,043 OAuth2 module tests and all 39 device verification and device PKCE browser scenarios passed with the fix. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The shared Verification URL scenarios exercise three session states and assert that the device can redeem its token after confirmation.
issue (blocking): Keep the first device login on HTTPS when the realm has an HTTPS Base URL.
DeviceCodeVerificationResource.java:702–714
With a fixed HTTPS Base URL and a configured HTTP Verification URL, the first GET can select the HTTP alias and build the standard /UI/Login URL from it. The previous revision built this login URL from the HTTPS Base URL. A signed-out visitor can be sent to a plaintext login page when the legacy HTTP listener still serves it. An HTTPS form can also receive HTTP XUI script URLs if a TLS-terminating proxy presents the matching HTTP address to OpenAM. Previous login construction · Initial login on HEAD · XUI asset URL
Apply the HTTPS requirement already enforced for shared addresses on POST to the initial address selection. Keep the query intact and retain support for configured alternate HTTPS origins. Existing POST guard
Closure criterion With a fixed HTTPS Base URL, opening an advertised HTTP verification alias keeps both the first login and the verification form on HTTPS. The advertised query survives the login, and an alternate configured HTTPS origin still works.
…th2 device user code
… during device verification
…sted ACR is unmet
…mation session changes
…evice login on HTTPS
… and HTTPS upgrades
543427b to
bacdf36
Compare
|
@maximthomas, I fixed the HTTPS downgrade in bacdf36. The initial GET now applies the same HTTPS requirement as the POST when selecting the public form address. I checked both cases in Chromium behind a TLS-terminating proxy. Opening the advertised HTTP address while signed out returned a 303 to HTTPS All 1,045 OAuth2 module tests passed. All 39 device verification and PKCE browser scenarios passed across runs. The two-tab session-replacement test hit its five-second wait for the code field twice and passed on the final run with that same timeout. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The updated tests pin the HTTPS login URL, retain the return query, and cover selection of a configured HTTPS form address behind a TLS proxy.
issue (blocking): Move the browser to the HTTPS form before loading XUI from a different hostname.
DeviceCodeVerificationResource.java:701–717
With an existing root session valid on the advertised HTTP alias and a fixed HTTPS Base URL on another hostname, the previous revision loaded the code form and its assets from the alias. HEAD selects the HTTPS Base URL for the assets but renders the document on the HTTP alias. The template only navigates to HTTPS when the hostnames match, so RequireJS tries to load a cross-origin JavaScript wrapper for the device template that the distribution does not ship. The code input never renders. Previous address selection · Form rendering · Hostname check and asset URL · XUI template dependency
if (location.protocol === "http:" && location.hostname === secureForm.hostname) {
require.skipDataMain = true;
secureForm.hash = location.hash;
location.replace(secureForm.href);
}XUI/main-device.js requires text!templates/user/DeviceTemplate.html
XUI/templates/user/DeviceTemplate.html is present in the WAR.
XUI/templates/user/DeviceTemplate.html.js, the cross-origin wrapper, is absent.
Navigate to the trusted HTTPS form before rendering XUI when the selected hostname differs from the configured HTTP alias. Preserve the existing query and configured alternate HTTPS origins.
Closure criterion With a fixed HTTPS Base URL, signed-out users reach the first login over HTTPS, and signed-in users reach a working form over HTTPS even when the advertised HTTP alias uses a different hostname. The return query survives and a configured alternate HTTPS origin still works.
issue (blocking): Recognize the authorized HTTPS destination of a shared Verification URL on the first code submission.
DeviceCodeVerificationResource.java:701–717
If a child provider advertises a shared HTTP alias with realm=/, the child uses an HTTP Base URL, and root's fixed HTTPS Base URL is on another hostname, the previous revision returned from root login to the alias and the first submission reached child login. HEAD returns to the different HTTPS hostname. Address matching upgrades the advertised scheme and port while retaining the alias hostname, so the first child-code submission returns not_found before applying the issuing realm. Previous address selection · First POST · Address matching
if ("http".equalsIgnoreCase(target.getScheme()) && "https".equalsIgnoreCase(form.getScheme())) {
target.setScheme("https");
target.setHostPort(form.getHostPort() == -1 ? null : form.getHostPort());
}
return target.normalize().toUri().equals(form.toUri());Recognize the explicitly authorized HTTPS destination of the provider's shared address on the first POST. Keep the issuing-realm check and the realm, code, and cookie checks for continuations.
Closure criterion A child session can confirm and redeem a device code through the advertised shared URL. A root session, including one acquired through the first login, reaches child login before confirmation even when the first login moves the browser to a different HTTPS hostname.
…ss-host HTTPS upgrade
|
@maximthomas, I addressed both findings in 96ca94a.
All three session states redeemed the token in Chromium, both with the cross-host HTTP alias and with an explicitly configured alternate HTTPS origin. All 1,051 OAuth2 module tests and all 39 device verification and PKCE browser scenarios passed across the required configurations. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The Playwright scenarios now check that the code field renders at the expected HTTPS origin and that the device can redeem its token in each of the three session states.
issue (blocking): Treat an explicit HTTPS port 443 as the browser's default port on the first shared-form POST.
DeviceCodeVerificationResource.java:688–701
When a child provider advertises an HTTP verification alias on a different host and the route realm's fixed Base URL is https://login.example.com:443, the browser sends Origin: https://login.example.com. OpenAM preserves the configured port, so the raw URI comparison sends this POST through the alternate-origin branch with fixedHttpsDestination=false. The issuing provider's address still has the alias hostname and the endpoint returns the not_found form before the issuing realm can be applied. The previous revision rejected the cross-host POST regardless of port. This revision accepts it when the origins compare equal and still rejects it when only the default port differs. Base URL formatting · Address matching · First POST
The first POST selects the alternate-origin branch using the raw URI comparison.
if (!origin.equals(URI.create(canonical.getHostIdentifier()))) {
return providerSettingsFactory.advertisesVerificationAddress(realm, received.toUri(), false)
? received : null;
}Compare scheme, host, and effective port before selecting that branch. Keep the advertised path and query checks for the issuing realm. An independent reviewer confirmed the cause against both pinned revisions.
The added endpoint test case used the fixed Base URL https://login.example.com:443 and sent Origin: https://login.example.com. On HEAD, the case failed at the authorization assertion. The other five cases passed.
expected: true
but was: false
[ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
A temporary control run with normalized origin comparison passed the same six cases.
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
Closure criterion A child session can confirm and redeem a device code through the advertised shared URL. A root session, including one acquired through the first login, reaches child login before confirmation even when the first login moves the browser to a different HTTPS hostname. The fixed HTTPS origin must match with or without an explicit default port.
…ice verification origins
|
@maximthomas, I fixed the default-port mismatch in 2296609. On the first shared-form POST, OpenAM now normalizes the browser origin and the fixed origin before comparing them. A fixed HTTPS Base URL with an explicit port 443 matches the browser origin without a port. A fixed port of 8443 still requires that port in the origin. I added both cases to the existing endpoint test. On 96ca94a, only the port 443 case failed. With the fix, all seven cases passed, including the existing hostname and query checks. All 1,053 OAuth2 module tests passed. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The endpoint test now pairs a fixed port of 443 with a browser origin that omits the port and uses the same origin to check rejection on port 8443. Test cases
Fixes #1262
A signed-out user had to enter the same device code twice when login interrupted verification. With this change, the user enters the code once, including when the client requests a non-default authentication chain.
The default verification URI identifies the issuing realm and includes the requested
acr_valuesas a hint for the first login. This lets a child realm on a shared hostname direct the browser to the right login. An existing URI without a realm still shows the code form first. Its POST uses the realm stored on the device code.A child provider can advertise a shared Verification URL such as
/oauth2/device/user?realm=%2F&ui_locales=en, including on a different public hostname and port from the root realm's fixed Base URL. The first login preserves the form's query, includingrealmandui_locales.When the realm has a fixed HTTPS Base URL, OpenAM uses HTTPS for the first login, the return to the form, and the XUI scripts, even if the provider advertises an HTTP address or a TLS-terminating proxy forwards the request over HTTP. When the HTTP alias and the fixed HTTPS Base URL use different hostnames, a browser with an existing session opens the HTTPS form before starting XUI. An explicitly configured alternate HTTPS host and port can still serve the form.
On the first code submission, OpenAM uses the issuing realm if its provider advertises the form address. For a shared HTTP alias, OpenAM also recognizes the fixed HTTPS destination selected by the route realm, with the advertised path and query. An explicit HTTPS port 443 in the fixed Base URL matches a browser origin that omits the port. A non-default port must match. A child session can complete verification directly. A root session goes through child login before confirmation. On return, OpenAM checks the saved realm, device code, and browser cookie.
For a legacy HTTP bookmark, the point at which the browser moves to HTTPS depends on when OpenAM can identify the realm. If the realm selected by the bookmark has a same-host HTTPS Base URL, the browser upgrades before displaying the code field. If a realm-less bookmark opens on an HTTP root and the submitted code identifies an HTTPS child, the browser forwards the code in a POST to the child's public HTTPS address. OpenAM issues the secure continuation cookie there. After login the browser shows the code for confirmation, so the user enters it once. Both paths work through a TLS-terminating proxy.
The first login requires no device verification state when the user has yet to enter a code. Once the user submits a valid code, OpenAM checks its requested authentication chain, including on submissions without a
device_flowhandle.If the submitted code requires another login, OpenAM saves a short-lived reference to the device code in the shared Core Token Service (CTS). An opaque handle in the login return URL and a per-flow HttpOnly cookie bind the reference to the submitting browser. The reference expires with the device code. Any OpenAM node using the shared CTS can restore the code for confirmation. OpenAM redirects the browser to a clean verification form in the same realm if the handle is stale, the return URL is opened in another browser, or the submitted code conflicts with the saved reference.
On return, OpenAM checks the current SSO session against the ACR stored on the device code. If a custom login page returns the default chain again, the browser shows the required authentication method and the device stays pending. If the chain matches, the user confirms the restored code with a CSRF-protected POST. Explicit consent still requires the user's approval.
If the SSO session changes after the confirmation form opens and the replacement session lacks the required ACR, submitting the form requests the mapped chain again with
ForceAuth=true. Custom login templates receive the booleanforceAuthso they can forward the flag. After a successful login the browser restores the submitted code for confirmation.Tests
2296609a20. The shared-form endpoint test accepts a browser origin without a port when the fixed HTTPS Base URL specifies port 443 and rejects the same origin when the fixed port is 8443. The port 443 case failed on96ca94adc0.bacdf36350. An existing root session stayed on the HTTP alias. A signed-out visitor reached the HTTPS form after login, but submitting the child code returned HTTP 200 instead of redirecting to child login.96ca94adc0, Chromium completed verification and redeemed the token in all three session states (signed out, root session, child session) behind a TLS-terminating proxy. Each state passed with a shared HTTP alias on a different hostname from root's fixed HTTPS Base URL and again with a configured alternate HTTPS origin. The form retainedrealmandui_locales. Root sessions completed child login before confirmation.__Host-continuation cookie withSecureandHttpOnlyon HTTPS. Child login restored the submitted code, the device stayed pending until confirmation, and the token was redeemed after one code entry. With an HTTPS root, the bookmark upgraded before code entry. The signed-out shared-URL case and the child-only HTTPS case both failed one37e8540e5before this fix.91b5c816fa, all 34 device verification and device PKCE scenarios passed with CTS shared through OpenDJ. In the mapped-chain test, the proxy's response headers verified that node A accepted the first submission, node B served the restored code after login, and node A accepted confirmation. The user entered the code once, the device stayed pending until confirmation, and the issued ID token contained the requestedacr.acr.gotoleaves the device pending and shows an error naming the required ACR. A template that selects the mapped chain restores the submitted code and records the matchingacrin the ID token after confirmation.isConsentImpliedfromtruetofalse, and the browser displayed the consent prompt.