forked from baron/baron-sso
Implement tenant import and RP auto login policies
This commit is contained in:
@@ -6,6 +6,8 @@ LinkedRp _linkedRp({
|
||||
required String status,
|
||||
String url = '',
|
||||
String initUrl = '',
|
||||
bool autoLoginSupported = false,
|
||||
String autoLoginUrl = '',
|
||||
}) {
|
||||
return LinkedRp(
|
||||
id: 'client-1',
|
||||
@@ -13,6 +15,8 @@ LinkedRp _linkedRp({
|
||||
logo: '',
|
||||
url: url,
|
||||
initUrl: initUrl,
|
||||
autoLoginSupported: autoLoginSupported,
|
||||
autoLoginUrl: autoLoginUrl,
|
||||
status: status,
|
||||
scopes: const ['openid', 'profile'],
|
||||
lastAuthenticatedAt: null,
|
||||
@@ -27,20 +31,25 @@ void main() {
|
||||
'status': 'active',
|
||||
'url': 'https://example.com',
|
||||
'init_url': 'https://sso.example.com/oidc/oauth2/auth?client_id=client-1',
|
||||
'auto_login_supported': true,
|
||||
'auto_login_url': 'https://example.com/login?auto=1',
|
||||
});
|
||||
|
||||
expect(
|
||||
rp.initUrl,
|
||||
'https://sso.example.com/oidc/oauth2/auth?client_id=client-1',
|
||||
);
|
||||
expect(rp.autoLoginSupported, isTrue);
|
||||
expect(rp.autoLoginUrl, 'https://example.com/login?auto=1');
|
||||
});
|
||||
|
||||
test('활성 앱은 initUrl을 우선 진입 URL로 사용한다', () {
|
||||
test('자동 로그인 지원 앱은 initUrl을 우선 진입 URL로 사용한다', () {
|
||||
final launchUrl = resolveLinkedRpLaunchUrl(
|
||||
_linkedRp(
|
||||
status: 'active',
|
||||
url: 'https://example.com',
|
||||
initUrl: 'https://sso.example.com/oidc/oauth2/auth?client_id=client-1',
|
||||
autoLoginSupported: true,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -50,7 +59,20 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('활성 앱은 initUrl이 없으면 기존 url로 폴백한다', () {
|
||||
test('자동 로그인 미지원 앱은 initUrl이 있어도 기존 url로 폴백한다', () {
|
||||
final launchUrl = resolveLinkedRpLaunchUrl(
|
||||
_linkedRp(
|
||||
status: 'active',
|
||||
url: 'https://example.com',
|
||||
initUrl: 'https://sso.example.com/oidc/oauth2/auth?client_id=client-1',
|
||||
autoLoginSupported: false,
|
||||
),
|
||||
);
|
||||
|
||||
expect(launchUrl, 'https://example.com');
|
||||
});
|
||||
|
||||
test('활성 앱은 자동 로그인 URL이 없으면 기존 url로 폴백한다', () {
|
||||
final launchUrl = resolveLinkedRpLaunchUrl(
|
||||
_linkedRp(status: 'active', url: 'https://example.com'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user