Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ public class SsoInvitationAcceptRequest {
private String provider;
private Boolean switchTenant;
private String redirectTo;
/** Mobile-app flow: forwarded to {@code /oauth/continue} — see {@link SsoTenantRegistrationInitRequest#isAuthMobile()}. */
private boolean authMobile;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public class SsoTenantRegistrationInitRequest {
// Optional final redirect target (absolute or allowed host)
private String redirectTo;

/**
* Mobile-app flow: forwarded to the BFF {@code /oauth/continue} after finalization so the
* callback attaches the one-time ticket the app exchanges for tokens (same contract as
* {@code /oauth/login?authMobile=true}).
*/
private boolean authMobile;

private RegistrationAttribution attribution;
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public record SsoInviteCookiePayload(
Boolean switchTenant,
String provider,
String redirectTo,
boolean authMobile,
long iat,
long exp
) implements SsoCookiePayload {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public record SsoTenantRegCookiePayload(
String tenantDomain,
String provider,
String redirectTo,
boolean authMobile,
String accessCode,
RegistrationAttribution attribution,
long iat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void handle(HttpServletRequest request, HttpServletResponse response, Aut
String targetTenantId = userCreated.getTenantId();

// Clear SSO flow cookie but KEEP session to allow OAuth continue
clearFlowCookieAndRedirect(response, cookie, targetTenantId, payload.redirectTo());
clearFlowCookieAndRedirect(response, cookie, targetTenantId, payload.redirectTo(), payload.authMobile());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ default String[] resolveNames(HttpServletRequest request, Authentication authent
default void clearFlowCookieAndRedirect(HttpServletResponse response,
Cookie flowCookie,
String tenantId,
String redirectTo) {
String redirectTo,
boolean authMobile) {
clearCookie(response, flowCookie.getName());
String path = "/oauth/continue?tenantId=" +
encode(tenantId, UTF_8);
if (hasText(redirectTo)) {
path += "&redirectTo=" + encode(redirectTo, UTF_8);
}
if (authMobile) {
path += "&authMobile=true";
}
foundAtRoot(response, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void handle(HttpServletRequest request, HttpServletResponse response, Aut

var tenant = registrationService.registerTenant(reg);

clearFlowCookieAndRedirect(response, cookie, tenant.getId(), payload.redirectTo());
clearFlowCookieAndRedirect(response, cookie, tenant.getId(), payload.redirectTo(), payload.authMobile());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public SsoAuthorizeData startAccept(SsoInvitationAcceptRequest request) {
request.getSwitchTenant(),
provider,
request.getRedirectTo(),
request.isAuthMobile(),
now,
now + COOKIE_TTL_SECONDS
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private SsoTenantRegCookiePayload buildCookiePayload(SsoTenantRegistrationInitRe
request.getTenantDomain(),
provider,
request.getRedirectTo(),
request.isAuthMobile(),
request.getAccessCode(),
boundedAttribution(request.getAttribution()),
issuedAt,
Expand Down
Loading