@@ -63,33 +63,34 @@ protected async Task<ApiSession> OpenSession(Parameters parameters)
6363 {
6464 throw new Exception ( $ "Server has no space '{ parameters . SpaceName } '") ;
6565 }
66- switch ( desiredSpace . SpaceAccessRestriction )
66+
67+
68+ if ( desiredSpace . SpaceAuthenticationProviderTypes . Contains ( IdPType . SpacePwd ) )
6769 {
68- case SpaceAccessRestriction . None :
69- _output . WriteInfo ( "Method: Anonymous access" ) ;
70- break ;
71- case SpaceAccessRestriction . BasicPassword when string . IsNullOrWhiteSpace ( parameters . Password ) :
72- _output . WriteInfo ( "Method: Password protected space" ) ;
73- throw new Exception ( $ "Space '{ parameters . SpaceName } ' requires password. You should pass '-password' parameter") ;
74- case SpaceAccessRestriction . BasicPassword :
75- _output . WriteInfo ( "Method: Password protected space" ) ;
76- break ;
77- case SpaceAccessRestriction . WindowsAuthentication :
78- _output . WriteInfo ( "Method: Windows authentication" ) ;
79- break ;
80- case SpaceAccessRestriction . NotSupported when desiredSpace . IsPublic :
81- _output . WriteInfo ( "Method: Fall-back anonymous session" ) ;
82- break ;
83- case SpaceAccessRestriction . NotSupported when ! desiredSpace . IsPublic & string . IsNullOrWhiteSpace ( parameters . Password ) :
70+ _output . WriteInfo ( "Method: Password protected space" ) ;
71+ if ( string . IsNullOrWhiteSpace ( parameters . Password ) )
72+ {
8473 throw new Exception ( $ "Space '{ parameters . SpaceName } ' requires password. You should pass '-password' parameter") ;
85- case SpaceAccessRestriction . NotSupported when ! desiredSpace . IsPublic :
86- _output . WriteInfo ( "Method: Fall-back password protected space" ) ;
87- break ;
88- default :
89- throw new Exception ( "Space access restriction method is not supported by this client." ) ;
74+ }
75+
76+ }
77+ else if ( desiredSpace . SpaceAuthenticationProviderTypes . Contains ( IdPType . Anonymous ) )
78+ {
79+ _output . WriteInfo ( "Method: Anonymous access" ) ;
80+ }
81+ else if ( desiredSpace . SpaceAuthenticationProviderTypes . Contains ( IdPType . AdSeamlessIdP ) )
82+ {
83+ // windows authentication
84+ _output . WriteInfo ( "Method: Windows authentication" ) ;
9085 }
86+ else
87+ {
88+ throw new Exception ( "Space access authentification method is not supported by this client." ) ;
89+ }
90+
91+
9192
92- var session = await _apiClient . OpenSessionAsync ( new OpenSessionRequest { SpaceName = parameters . SpaceName , Password = parameters . Password } , _cancellationTokenSource . Token ) ;
93+ var session = await _apiClient . OpenLegacySessionAsync ( new OpenLegacySessionRequest { SpaceName = parameters . SpaceName , Password = parameters . Password } , _cancellationTokenSource . Token ) ;
9394 _output . WriteInfo ( "Session opened" ) ;
9495 return session ;
9596 }
0 commit comments