forked from baron/baron-sso
userfront 로그인 후 /dashboard로 이동하게 변경
This commit is contained in:
40
userfront/test/cookie_session_policy_test.dart
Normal file
40
userfront/test/cookie_session_policy_test.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:userfront/features/auth/domain/cookie_session_policy.dart';
|
||||
|
||||
void main() {
|
||||
group('cookie_session_policy', () {
|
||||
test('토큰이 없고 login_challenge도 없으면 cookie 승격 허용', () {
|
||||
expect(
|
||||
shouldPromoteCookieSession(currentToken: null, loginChallenge: null),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
test('토큰이 이미 있으면 일반 로그인에서 cookie 승격 차단', () {
|
||||
expect(
|
||||
shouldPromoteCookieSession(
|
||||
currentToken: 'existing-token',
|
||||
loginChallenge: null,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('OIDC login_challenge가 있으면 token 존재 시에도 cookie 승격 허용', () {
|
||||
expect(
|
||||
shouldPromoteCookieSession(
|
||||
currentToken: 'existing-token',
|
||||
loginChallenge: 'lc_123',
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
test('공백 토큰은 유효 토큰으로 간주하지 않음', () {
|
||||
expect(
|
||||
shouldPromoteCookieSession(currentToken: ' ', loginChallenge: null),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user