Show / Hide Table of Contents

Class SoSession

Session object used to authenticate and handle a SuperOffice session

Inheritance
Object
SoSession
Implements
IDisposable
Namespace: SuperOffice
Assembly: SoCore.dll
Syntax
public sealed class SoSession : Object, 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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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
Boolean
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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

Principal

The principal the session represents

Declaration
public SoPrincipal Principal { get; }
Property Value
Type Description
SoPrincipal
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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

Authenticate(ClaimsIdentity, 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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

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.

Examples

The user is authenticated using the Authenticate method:

SoSession session = SoSession.Authenticate("user", "Password");
// Do some stuff.
session.Close();

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

Continue(String)

Continue a session that has ben suspended.

Declaration
public static SoSession Continue(string state)
Parameters
Type Name Description
String state

State as returned by the Suspend method

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

Suspend()

Suspend the session and retrieve a "session-id"

Declaration
public string Suspend()
Returns
Type Description
String

"Session id" or state of the current session.

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(String) 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(SuperOffice.Security.Principal.SoCredentials). the Continue(String) method will use SuperOffice.Security.Principal.Private.PrincipalHelper.DeserializeCredentials(System.String) 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();

Implements

System.IDisposable

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top