Rename allauth's URLs

This commit is contained in:
Roland Geider
2026-06-15 14:11:33 +02:00
parent 499d15636a
commit 62042bd832
8 changed files with 17 additions and 17 deletions

View File

@@ -51,7 +51,7 @@ import 'package:wger/providers/user_profile_notifier.dart';
part 'auth_notifier.g.dart';
/// `allauth.headless` `app` client endpoints, relative to the
/// `/_allauth/app/v1/` base.
/// `/allauth/app/v1/` base.
const HEADLESS_TOKENS_REFRESH_PATH = 'tokens/refresh';
const HEADLESS_AUTH_LOGIN_PATH = 'auth/login';
const HEADLESS_AUTH_SIGNUP_PATH = 'auth/signup';

View File

@@ -71,7 +71,7 @@ class WgerBaseProvider {
return makeUri(serverUrl!, path, id: id, objectMethod: objectMethod, query: query);
}
/// Builds a `/_allauth/app/v1/<path>` URL for the headless API.
/// Builds a `/allauth/app/v1/<path>` URL for the headless API.
Uri makeHeadlessUrl(String path) => makeHeadlessUri(serverUrl!, path);
/// Fetch and retrieve the overview list of objects, returns the JSON parsed response

View File

@@ -89,7 +89,7 @@ Uri makeUri(
}
/// Builds a URL for the `allauth.headless` `app` client API at
/// `/_allauth/app/v1/<path>`. Used by the auth notifier for login,
/// `/allauth/app/v1/<path>`. Used by the auth notifier for login,
/// signup, MFA, refresh, etc. The headless API does not use a trailing
/// slash and lives on a separate URL prefix from the DRF data API.
Uri makeHeadlessUri(String serverUrl, String path) {
@@ -98,7 +98,7 @@ Uri makeHeadlessUri(String serverUrl, String path) {
scheme: uriServer.scheme,
host: uriServer.host,
port: uriServer.port,
path: [uriServer.path, '_allauth', 'app', 'v1', path].join('/'),
path: [uriServer.path, 'allauth', 'app', 'v1', path].join('/'),
);
}

View File

@@ -90,8 +90,8 @@ void main() {
isTrustworthy: true,
);
final tHeadlessLogin = Uri.parse('$serverUrl/_allauth/app/v1/auth/login');
final tHeadlessSignup = Uri.parse('$serverUrl/_allauth/app/v1/auth/signup');
final tHeadlessLogin = Uri.parse('$serverUrl/allauth/app/v1/auth/login');
final tHeadlessSignup = Uri.parse('$serverUrl/allauth/app/v1/auth/signup');
final tVersion = Uri.parse('$serverUrl/api/v2/version/');
final tMinAppVersion = Uri.parse('$serverUrl/api/v2/min-app-version/');
final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token');
@@ -503,7 +503,7 @@ void main() {
});
group('login: pasted refresh token', () {
final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh');
final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh');
test('exchanges at tokens/refresh and stores the rotated bundle', () async {
final newAccess = makeJwt({'exp': 1900000000});
@@ -600,7 +600,7 @@ void main() {
});
group('completeMfa', () {
final tMfa = Uri.parse('$serverUrl/_allauth/app/v1/auth/2fa/authenticate');
final tMfa = Uri.parse('$serverUrl/allauth/app/v1/auth/2fa/authenticate');
test('200 persists tokens and reaches loggedIn', () async {
final accessJwt = makeJwt({'exp': 1900000000});

View File

@@ -79,7 +79,7 @@ void main() {
final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token');
final tLiveness = Uri.parse('${powerSyncUrl}probes/liveness');
final tIssueRefresh = Uri.parse('$serverUrl/api/v2/issue-refresh-token');
final tHeadlessRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh');
final tHeadlessRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh');
/// Builds a fresh ProviderContainer with the mock HTTP client wired into
/// the auth notifier. Auto-disposes after the test.
@@ -956,7 +956,7 @@ void main() {
});
group('background revalidation: headless pre-emptive refresh', () {
final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh');
final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh');
String makeJwt(Map<String, dynamic> payload) {
String enc(Map<String, dynamic> m) =>
@@ -1022,7 +1022,7 @@ void main() {
});
group('refreshAccessToken', () {
final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh');
final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh');
/// Builds a JWT-shaped string with the given payload (signature is a sham,
/// we only ever decode the middle segment).

View File

@@ -65,17 +65,17 @@ void main() {
final Uri tHeadlessLogin = Uri(
scheme: 'https',
host: 'wger.de',
path: '/_allauth/app/v1/auth/login',
path: '/allauth/app/v1/auth/login',
);
final Uri tHeadlessSignup = Uri(
scheme: 'https',
host: 'wger.de',
path: '/_allauth/app/v1/auth/signup',
path: '/allauth/app/v1/auth/signup',
);
final Uri tHeadlessRefresh = Uri(
scheme: 'https',
host: 'wger.de',
path: '/_allauth/app/v1/tokens/refresh',
path: '/allauth/app/v1/tokens/refresh',
);
const validJwt = 'header.payload.signature';
@@ -412,7 +412,7 @@ void main() {
final tHeadlessLoginCustom = Uri(
scheme: 'https',
host: 'my.server',
path: '/_allauth/app/v1/auth/login',
path: '/allauth/app/v1/auth/login',
);
when(
mockClient.post(

View File

@@ -46,7 +46,7 @@ void main() {
const serverUrl = 'https://wger.example';
const powerSyncUrl = 'https://ps.example/';
final tMfa = Uri.parse('$serverUrl/_allauth/app/v1/auth/2fa/authenticate');
final tMfa = Uri.parse('$serverUrl/allauth/app/v1/auth/2fa/authenticate');
final tVersion = Uri.parse('$serverUrl/api/v2/version/');
final tMinAppVersion = Uri.parse('$serverUrl/api/v2/min-app-version/');
final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token');

View File

@@ -57,7 +57,7 @@ void main() {
});
group('email management via headless', () {
final emailUri = Uri.https('localhost', '/_allauth/app/v1/account/email');
final emailUri = Uri.https('localhost', '/allauth/app/v1/account/email');
test('requestEmailChange POSTs the new address to account/email', () async {
when(mockBase.makeHeadlessUrl('account/email')).thenReturn(emailUri);