@@ -11,47 +11,34 @@ namespace CodeBeam.UltimateAuth.Tests.Unit.Helpers;
1111
1212internal static class AuthFlowTestFactory
1313{
14- public static AuthFlowContext LoginSuccess ( ReturnUrlInfo ? returnUrlInfo = null , EffectiveRedirectResponse ? redirect = null )
15- {
16- return new AuthFlowContext (
17- flowType : AuthFlowType . Login ,
18- clientProfile : UAuthClientProfile . BlazorServer ,
19- effectiveMode : UAuthMode . PureOpaque ,
20- device : TestDevice . Default ( ) ,
21- tenantKey : TenantKey . Single ,
22- isAuthenticated : true ,
23- userKey : UserKey . New ( ) ,
24- session : null ,
25- originalOptions : TestServerOptions . Default ( ) ,
26- effectiveOptions : TestServerOptions . Effective ( ) ,
27- response : new EffectiveAuthResponse (
28- sessionIdDelivery : CredentialResponseOptions . Disabled ( GrantKind . Session ) ,
29- accessTokenDelivery : CredentialResponseOptions . Disabled ( GrantKind . AccessToken ) ,
30- refreshTokenDelivery : CredentialResponseOptions . Disabled ( GrantKind . RefreshToken ) ,
31- redirect : redirect ?? EffectiveRedirectResponse . Disabled
32- ) ,
33- primaryTokenKind : PrimaryTokenKind . Session ,
34- returnUrlInfo : returnUrlInfo ?? ReturnUrlInfo . None ( )
35- ) ;
36- }
14+ public static AuthFlowContext LoginSuccess (
15+ ReturnUrlInfo ? returnUrlInfo = null ,
16+ EffectiveRedirectResponse ? redirect = null )
17+ => New (
18+ returnUrlInfo : returnUrlInfo ,
19+ redirect : redirect ) ;
3720
3821 public static AuthFlowContext New (
3922 ReturnUrlInfo ? returnUrlInfo = null ,
4023 EffectiveRedirectResponse ? redirect = null ,
41- TenantKey ? tenant = null )
24+ TenantKey ? tenant = null ,
25+ UserKey ? userKey = null ,
26+ SessionSecurityContext ? session = null ,
27+ bool isAuthenticated = true ,
28+ EffectiveAuthResponse ? response = null )
4229 {
4330 return new AuthFlowContext (
4431 flowType : AuthFlowType . Login ,
4532 clientProfile : UAuthClientProfile . BlazorServer ,
4633 effectiveMode : UAuthMode . PureOpaque ,
4734 device : TestDevice . Default ( ) ,
4835 tenantKey : tenant ?? TenantKey . Single ,
49- isAuthenticated : true ,
50- userKey : UserKey . New ( ) ,
51- session : null ,
36+ isAuthenticated : isAuthenticated ,
37+ userKey : userKey ?? ( isAuthenticated ? UserKey . New ( ) : null ) ,
38+ session : session ,
5239 originalOptions : TestServerOptions . Default ( ) ,
5340 effectiveOptions : TestServerOptions . Effective ( ) ,
54- response : new EffectiveAuthResponse (
41+ response : response ?? new EffectiveAuthResponse (
5542 sessionIdDelivery :
5643 CredentialResponseOptions . Disabled ( GrantKind . Session ) ,
5744 accessTokenDelivery :
0 commit comments