forked from baron/baron-sso
offline 스코프 제거, rp_claims 값 표준화
This commit is contained in:
11
userfront/lib/features/auth/domain/consent_scope_policy.dart
Normal file
11
userfront/lib/features/auth/domain/consent_scope_policy.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
bool isRefreshTokenScopeAlias(String scope) {
|
||||
final normalized = scope.trim().toLowerCase();
|
||||
return normalized == 'offline' || normalized == 'offline_access';
|
||||
}
|
||||
|
||||
List<String> filterConsentScopes(Iterable<String> scopes) {
|
||||
return scopes
|
||||
.map((scope) => scope.trim())
|
||||
.where((scope) => scope.isNotEmpty && !isRefreshTokenScopeAlias(scope))
|
||||
.toList(growable: false);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:userfront/core/services/auth_proxy_service.dart';
|
||||
import 'package:userfront/core/services/web_window.dart';
|
||||
import 'package:userfront/core/ui/toast_service.dart';
|
||||
import 'package:userfront/features/auth/domain/consent_error_routing.dart';
|
||||
import 'package:userfront/features/auth/domain/consent_scope_policy.dart';
|
||||
|
||||
class ConsentScreen extends StatefulWidget {
|
||||
final String consentChallenge;
|
||||
@@ -53,10 +54,6 @@ class _ConsentScreenState extends State<ConsentScreen> {
|
||||
'msg.userfront.consent.scope.email',
|
||||
fallback: 'Email address (account identification and notifications)',
|
||||
),
|
||||
'offline_access': tr(
|
||||
'msg.userfront.consent.scope.offline_access',
|
||||
fallback: 'Offline access (keep signed in)',
|
||||
),
|
||||
'phone': tr(
|
||||
'msg.userfront.consent.scope.phone',
|
||||
fallback: 'Phone number (identity verification and notifications)',
|
||||
@@ -80,9 +77,6 @@ class _ConsentScreenState extends State<ConsentScreen> {
|
||||
}
|
||||
|
||||
String _scopeDisplayLabel(String scope) {
|
||||
if (scope == 'offline_access') {
|
||||
return 'offline access';
|
||||
}
|
||||
return scope.replaceAll('_', ' ');
|
||||
}
|
||||
|
||||
@@ -138,9 +132,11 @@ class _ConsentScreenState extends State<ConsentScreen> {
|
||||
}
|
||||
|
||||
// 초기 선택 상태 설정: 모든 요청된 스코프를 기본 선택
|
||||
final requestedScopes =
|
||||
(info['requested_scope'] as List<dynamic>?)?.cast<String>() ?? [];
|
||||
final requestedScopes = filterConsentScopes(
|
||||
(info['requested_scope'] as List<dynamic>?)?.cast<String>() ?? [],
|
||||
);
|
||||
_selectedScopes.addAll(requestedScopes);
|
||||
info['requested_scope'] = requestedScopes;
|
||||
|
||||
setState(() {
|
||||
_consentInfo = info;
|
||||
@@ -299,9 +295,10 @@ class _ConsentScreenState extends State<ConsentScreen> {
|
||||
? clientId
|
||||
: tr('msg.userfront.consent.client_unknown'));
|
||||
final clientLogo = _consentInfo?['client']?['logo_uri'];
|
||||
final requestedScopes =
|
||||
(_consentInfo?['requested_scope'] as List<dynamic>?)?.cast<String>() ??
|
||||
[];
|
||||
final requestedScopes = filterConsentScopes(
|
||||
(_consentInfo?['requested_scope'] as List<dynamic>?)?.cast<String>() ??
|
||||
[],
|
||||
);
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
|
||||
@@ -597,7 +597,6 @@ const Map<String, String> koStrings = {
|
||||
"msg.userfront.consent.missing_redirect": "동의가 처리되었으나 리다이렉트 URL을 받지 못했습니다.",
|
||||
"msg.userfront.consent.redirect_notice": "동의 후 자동으로 서비스로 이동합니다.",
|
||||
"msg.userfront.consent.scope.email": "이메일 주소 (계정 식별 및 알림 용도)",
|
||||
"msg.userfront.consent.scope.offline_access": "오프라인 접근 (로그인 유지)",
|
||||
"msg.userfront.consent.scope.openid": "OpenID 인증 정보 (로그인 상태 확인)",
|
||||
"msg.userfront.consent.scope.phone": "휴대폰 번호 (본인 인증 및 알림)",
|
||||
"msg.userfront.consent.scope.profile": "기본 프로필 정보 (이름, 사용자 식별자)",
|
||||
@@ -2982,8 +2981,6 @@ const Map<String, String> enStrings = {
|
||||
"After consent, you will be redirected automatically.",
|
||||
"msg.userfront.consent.scope.email":
|
||||
"Email address (account identification and notifications)",
|
||||
"msg.userfront.consent.scope.offline_access":
|
||||
"Offline access (keep signed in)",
|
||||
"msg.userfront.consent.scope.openid":
|
||||
"OpenID authentication information (signin session check)",
|
||||
"msg.userfront.consent.scope.phone":
|
||||
|
||||
Reference in New Issue
Block a user