refact, common oidc
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
4e1d7ca3de
commit
2c86fac208
@ -167,8 +167,20 @@ class UserModel {
|
|||||||
try {
|
try {
|
||||||
final url = await bind.mainGetApiServer();
|
final url = await bind.mainGetApiServer();
|
||||||
if (url.trim().isEmpty) return [];
|
if (url.trim().isEmpty) return [];
|
||||||
final resp = await http.get(Uri.parse('$url/api/oidc/login-options'));
|
final resp = await http.get(Uri.parse('$url/api/login-options'));
|
||||||
return jsonDecode(resp.body);
|
final List<String> ops = [];
|
||||||
|
for (final item in jsonDecode(resp.body)) {
|
||||||
|
ops.add(item as String);
|
||||||
|
}
|
||||||
|
for (final item in ops) {
|
||||||
|
if (item.startsWith('common-oidc/')) {
|
||||||
|
return jsonDecode(item.substring('common-oidc/'.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ops
|
||||||
|
.where((item) => item.startsWith('oidc/'))
|
||||||
|
.map((item) => {'name': item.substring('oidc/'.length)})
|
||||||
|
.toList();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"queryOidcLoginOptions: jsonDecode resp body failed: ${e.toString()}");
|
"queryOidcLoginOptions: jsonDecode resp body failed: ${e.toString()}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user