Class SoSession
Session object used to authenticate and handle a SuperOffice session
Implements
Inherited Members
Namespace: SuperOffice
Assembly: SoCore.dll
Syntax
public sealed class SoSession : IDisposable
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Examples
The user is authenticated using the Authenticate method:
SoSession session = SoSession.Authenticate("user", "Password");
// Do some stuff.
session.Close();
Properties
IsOpen
Check if the session is active/open.
Declaration
public bool IsOpen { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Principal
The principal the session represents
Declaration
public ClaimsPrincipal Principal { get; }
Property Value
| Type | Description |
|---|---|
| ClaimsPrincipal |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Methods
Authenticate()
Autehnticate the user based upon the currently loggged in windows user.
Declaration
public static SoSession Authenticate()
Returns
| Type | Description |
|---|---|
| SoSession | SoSession object representing the session if succeeded, and null if failed. |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Authenticate(SoCredentials)
Authenticate the user from an SoCredentials object.
If you are authenticating with WindowsAuthentication and not logged
in as this user, a valid WindowsIdentity needs to be provided as well.
Declaration
public static SoSession Authenticate(SoCredentials credentials)
Parameters
| Type | Name | Description |
|---|---|---|
| SoCredentials | credentials | SoCredentials object holding user token. |
Returns
| Type | Description |
|---|---|
| SoSession | SoSession object representing the session if succeeded, and null if failed. |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Authenticate(SoCredentials, WindowsIdentity)
Authenticate the user from an SoCredentials object with a provided WindowsIdentity.
Declaration
public static SoSession Authenticate(SoCredentials credentials, WindowsIdentity identity)
Parameters
| Type | Name | Description |
|---|---|---|
| SoCredentials | credentials | SoCredentials object holding user token. |
| WindowsIdentity | identity | WindowsIdentity backing up the SoCredentials |
Returns
| Type | Description |
|---|---|
| SoSession |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Authenticate(ClaimsIdentity, params Claim[])
Authenticate the user from an ClaimsIdentity object.
Declaration
public static SoSession Authenticate(ClaimsIdentity identity, params Claim[] additionalClaims)
Parameters
| Type | Name | Description |
|---|---|---|
| ClaimsIdentity | identity | The identity of an authenticated user that can be processed and mapped to an associate. |
| Claim[] | additionalClaims |
Returns
| Type | Description |
|---|---|
| SoSession | SoSession object representing the session if succeeded, and null if failed. |
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Authenticate(string, string)
Authenticate a user using the CRM5 username and password; the username can also be a ticket string
Declaration
public static SoSession Authenticate(string user, string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | user | Username of the user or a token |
| string | password | The CRM5 password. |
Returns
| Type | Description |
|---|---|
| SoSession | SoSession object representing the session if succeeded, and null if failed. |
Remarks
If password is not provided, or null, we will attempt to threat the user parameter as a token: Ticket, access token, etc.
Close()
Close the session.
Declaration
public void Close()
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.
Dispose()
Dispose session by closing if still open
Declaration
public void Dispose()
Remarks
NetServer is designed to be both deployed locally and server-side.
- Local: A local application is an application that does something for one user. The application starts of by authenticating the user and provides some functionality to him. On completion, the user will log out. The entire time the application provides functionality to the user, there is a valid session on behalf of this user.
- Server-side: A server-side application serves several users. Users are performing operations or requests. There is a valid session for the user while he is performing the operation and the session is suspended between operations. An example of this is a web application. The user clicks something on the browser and sends off a request to the server. While the server is processing the request, the session is valid. Between the requests, the session is suspended.
The first operation performed against NetServer in a local application will be to Authenticate() and the last will be to Close() the session. The session object will not be used in extent of this in a local application.
In a server-side application, the user will be authenticated, by an underlying call to the Authenticate() method. As each request is completed, a Suspend should be called. As the next request starts, the suspended session will be continued using the Continue method.
The suspend method returns a string that represents the authenticated user. This string should be stored in the web- applications session-state. As it is needed for a continuation of the session, it should be fetched back from the web-applications session-state.
The Suspend method will return a SoCredentials object, serialized and decrypted using SuperOffice.Security.Principal.Private.PrincipalHelper.SerializeCredentials. the Continue method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials to decrypt end deserialize the credentials.