mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): mobile oauth with custom scheme redirect uri (#1204)
* feat(server): support providers without support for custom schemas * chore: unit tests * chore: test mobile override * chore: add details to the docs
This commit is contained in:
3
mobile/openapi/README.md
generated
3
mobile/openapi/README.md
generated
@@ -3,7 +3,7 @@ Immich API
|
||||
|
||||
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 1.39.0
|
||||
- API version: 1.40.0
|
||||
- Build package: org.openapitools.codegen.languages.DartClientCodegen
|
||||
|
||||
## Requirements
|
||||
@@ -109,6 +109,7 @@ Class | Method | HTTP request | Description
|
||||
*OAuthApi* | [**callback**](doc//OAuthApi.md#callback) | **POST** /oauth/callback |
|
||||
*OAuthApi* | [**generateConfig**](doc//OAuthApi.md#generateconfig) | **POST** /oauth/config |
|
||||
*OAuthApi* | [**link**](doc//OAuthApi.md#link) | **POST** /oauth/link |
|
||||
*OAuthApi* | [**mobileRedirect**](doc//OAuthApi.md#mobileredirect) | **GET** /oauth/mobile-redirect |
|
||||
*OAuthApi* | [**unlink**](doc//OAuthApi.md#unlink) | **POST** /oauth/unlink |
|
||||
*ServerInfoApi* | [**getServerInfo**](doc//ServerInfoApi.md#getserverinfo) | **GET** /server-info |
|
||||
*ServerInfoApi* | [**getServerVersion**](doc//ServerInfoApi.md#getserverversion) | **GET** /server-info/version |
|
||||
|
||||
37
mobile/openapi/doc/OAuthApi.md
generated
37
mobile/openapi/doc/OAuthApi.md
generated
@@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**callback**](OAuthApi.md#callback) | **POST** /oauth/callback |
|
||||
[**generateConfig**](OAuthApi.md#generateconfig) | **POST** /oauth/config |
|
||||
[**link**](OAuthApi.md#link) | **POST** /oauth/link |
|
||||
[**mobileRedirect**](OAuthApi.md#mobileredirect) | **GET** /oauth/mobile-redirect |
|
||||
[**unlink**](OAuthApi.md#unlink) | **POST** /oauth/unlink |
|
||||
|
||||
|
||||
@@ -138,6 +139,42 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **mobileRedirect**
|
||||
> mobileRedirect()
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final api_instance = OAuthApi();
|
||||
|
||||
try {
|
||||
api_instance.mobileRedirect();
|
||||
} catch (e) {
|
||||
print('Exception when calling OAuthApi->mobileRedirect: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **unlink**
|
||||
> UserResponseDto unlink()
|
||||
|
||||
|
||||
2
mobile/openapi/doc/SystemConfigOAuthDto.md
generated
2
mobile/openapi/doc/SystemConfigOAuthDto.md
generated
@@ -15,6 +15,8 @@ Name | Type | Description | Notes
|
||||
**scope** | **String** | |
|
||||
**buttonText** | **String** | |
|
||||
**autoRegister** | **bool** | |
|
||||
**mobileOverrideEnabled** | **bool** | |
|
||||
**mobileRedirectUri** | **String** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
33
mobile/openapi/lib/api/o_auth_api.dart
generated
33
mobile/openapi/lib/api/o_auth_api.dart
generated
@@ -157,6 +157,39 @@ class OAuthApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /oauth/mobile-redirect' operation and returns the [Response].
|
||||
Future<Response> mobileRedirectWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/oauth/mobile-redirect';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> mobileRedirect() async {
|
||||
final response = await mobileRedirectWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /oauth/unlink' operation and returns the [Response].
|
||||
Future<Response> unlinkWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
|
||||
@@ -20,6 +20,8 @@ class SystemConfigOAuthDto {
|
||||
required this.scope,
|
||||
required this.buttonText,
|
||||
required this.autoRegister,
|
||||
required this.mobileOverrideEnabled,
|
||||
required this.mobileRedirectUri,
|
||||
});
|
||||
|
||||
bool enabled;
|
||||
@@ -36,6 +38,10 @@ class SystemConfigOAuthDto {
|
||||
|
||||
bool autoRegister;
|
||||
|
||||
bool mobileOverrideEnabled;
|
||||
|
||||
String mobileRedirectUri;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigOAuthDto &&
|
||||
other.enabled == enabled &&
|
||||
@@ -44,7 +50,9 @@ class SystemConfigOAuthDto {
|
||||
other.clientSecret == clientSecret &&
|
||||
other.scope == scope &&
|
||||
other.buttonText == buttonText &&
|
||||
other.autoRegister == autoRegister;
|
||||
other.autoRegister == autoRegister &&
|
||||
other.mobileOverrideEnabled == mobileOverrideEnabled &&
|
||||
other.mobileRedirectUri == mobileRedirectUri;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
@@ -55,10 +63,12 @@ class SystemConfigOAuthDto {
|
||||
(clientSecret.hashCode) +
|
||||
(scope.hashCode) +
|
||||
(buttonText.hashCode) +
|
||||
(autoRegister.hashCode);
|
||||
(autoRegister.hashCode) +
|
||||
(mobileOverrideEnabled.hashCode) +
|
||||
(mobileRedirectUri.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigOAuthDto[enabled=$enabled, issuerUrl=$issuerUrl, clientId=$clientId, clientSecret=$clientSecret, scope=$scope, buttonText=$buttonText, autoRegister=$autoRegister]';
|
||||
String toString() => 'SystemConfigOAuthDto[enabled=$enabled, issuerUrl=$issuerUrl, clientId=$clientId, clientSecret=$clientSecret, scope=$scope, buttonText=$buttonText, autoRegister=$autoRegister, mobileOverrideEnabled=$mobileOverrideEnabled, mobileRedirectUri=$mobileRedirectUri]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final _json = <String, dynamic>{};
|
||||
@@ -69,6 +79,8 @@ class SystemConfigOAuthDto {
|
||||
_json[r'scope'] = scope;
|
||||
_json[r'buttonText'] = buttonText;
|
||||
_json[r'autoRegister'] = autoRegister;
|
||||
_json[r'mobileOverrideEnabled'] = mobileOverrideEnabled;
|
||||
_json[r'mobileRedirectUri'] = mobileRedirectUri;
|
||||
return _json;
|
||||
}
|
||||
|
||||
@@ -98,6 +110,8 @@ class SystemConfigOAuthDto {
|
||||
scope: mapValueOfType<String>(json, r'scope')!,
|
||||
buttonText: mapValueOfType<String>(json, r'buttonText')!,
|
||||
autoRegister: mapValueOfType<bool>(json, r'autoRegister')!,
|
||||
mobileOverrideEnabled: mapValueOfType<bool>(json, r'mobileOverrideEnabled')!,
|
||||
mobileRedirectUri: mapValueOfType<String>(json, r'mobileRedirectUri')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -154,6 +168,8 @@ class SystemConfigOAuthDto {
|
||||
'scope',
|
||||
'buttonText',
|
||||
'autoRegister',
|
||||
'mobileOverrideEnabled',
|
||||
'mobileRedirectUri',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
5
mobile/openapi/test/o_auth_api_test.dart
generated
5
mobile/openapi/test/o_auth_api_test.dart
generated
@@ -32,6 +32,11 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
//Future mobileRedirect() async
|
||||
test('test mobileRedirect', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
//Future<UserResponseDto> unlink() async
|
||||
test('test unlink', () async {
|
||||
// TODO
|
||||
|
||||
@@ -51,6 +51,16 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// bool mobileOverrideEnabled
|
||||
test('to test the property `mobileOverrideEnabled`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String mobileRedirectUri
|
||||
test('to test the property `mobileRedirectUri`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user