Click or drag to resize

SecurityService Class

Embedded WCF service that can be used for securing applications using role-based security.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    GSF.AdaptersAdapter
      GSF.ServiceModelSelfHostingService
        GSF.Web.EmbeddedSecurityService

Namespace: GSF.Web.Embedded
Assembly: GSF.Web (in GSF.Web.dll) Version: 2.4.218-beta
Syntax
View Source

The SecurityService type exposes the following members.

Constructors
 NameDescription
Public methodSecurityServiceInitializes a new instance of the SecurityService class
Top
Properties
 NameDescription
Public propertyAllowCrossDomainAccess Gets or sets flag that indicates if web services will enable cross-domain access for Silverlight and Flash applications.
(Inherited from SelfHostingService)
Public propertyAllowedDomainList Gets or sets comma separated list of allowed domains when AllowCrossDomainAccess is true. Use * for domain wildcards, e.g., *.consoto.com.
(Inherited from SelfHostingService)
Public propertyAutomaticFormatSelectionEnabled Gets or sets a value that determines if automatic format selection is enabled for Web HTTP bindings.
(Inherited from SelfHostingService)
Public propertyContractInterface Gets or sets the FullName of the contract interface implemented by the web service.
(Inherited from SelfHostingService)
Public propertyDefaultOutgoingRequestFormat Gets and sets the default outgoing request format for Web HTTP bindings.
(Inherited from SelfHostingService)
Public propertyDefaultOutgoingResponseFormat Gets and sets the default outgoing response format for Web HTTP bindings.
(Inherited from SelfHostingService)
Public propertyDomain Gets the AppDomain in which the Adapter is executing.
(Inherited from Adapter)
Public propertyEnabled Gets or sets a boolean value that indicates whether the web service is currently enabled.
(Inherited from SelfHostingService)
Public propertyEndpoints Gets or sets a semicolon delimited list of URIs where the web service can be accessed.
(Inherited from SelfHostingService)
Public propertyFaultExceptionEnabled Gets or sets the flag that specifies whether a FaultException is generated when an internal server error(HTTP status code: 500) occurs for Web HTTP bindings.
(Inherited from SelfHostingService)
Public propertyHostFile Gets or sets the path to the file where the Adapter is housed.
(Inherited from Adapter)
Public propertyIsDisposed Gets a flag that indicates whether the object has been disposed.
(Inherited from Adapter)
Public propertyJsonFaultHandlingEnabled Gets or sets a value that determines if JSON formatted fault messages should be returned during exceptions.
(Inherited from SelfHostingService)
Public propertyMemoryUsage Gets the memory utilization of the Adapter in bytes if executing in a separate AppDomain, otherwise NaN.
(Inherited from Adapter)
Public propertyName Gets the unique identifier of the Adapter.
(Inherited from Adapter)
Public propertyPersistSettings Gets or sets a boolean value that indicates whether Adapter settings are to be saved to the config file.
(Inherited from Adapter)
Public propertyProcessorUsage Gets the % processor utilization of the Adapter if executing in a separate AppDomain otherwise NaN.
(Inherited from Adapter)
Public propertyPublishMetadata Gets or sets a boolean value that indicates whether web service metadata is to made available at all web service Endpoints.
(Inherited from SelfHostingService)
Public propertySecurityPolicy Gets or sets the FullName of IAuthorizationPolicy to be used for securing all web service Endpoints.
(Inherited from SelfHostingService)
Public propertyServiceEnabled Gets or sets a boolean value that indicates whether the web service is to be enabled at startup.
(Inherited from SelfHostingService)
Public propertyServiceHost Gets the WebServiceHost hosting the web service.
(Inherited from SelfHostingService)
Public propertySettingsCategory Gets or sets the category under which Adapter settings are to be saved to the config file if the PersistSettings property is set to true.
(Inherited from Adapter)
Public propertySingleton Gets or sets a boolean value that indicates whether the ServiceHost will use the current instance of the web service for processing requests or base the web service instance creation on InstanceContextMode specified in its ServiceBehaviorAttribute.
(Inherited from SelfHostingService)
Public propertyStatus Gets the descriptive status of the Adapter.
(Inherited from Adapter)
Public propertyTypeName Gets or sets the text representation of the Adapter's TypeName.
(Inherited from Adapter)
Public propertyWindowsAuthentication Gets or sets a boolean value that indicates whether Windows Authentication is to be enabled.
(Inherited from SelfHostingService)
Top
Methods
 NameDescription
Public methodAuthenticate Authenticates a user and caches the security context upon successful authentication for subsequent use.
Public methodChangePassword Changes user password.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Public methodDispose Releases all the resources used by the Adapter.
(Inherited from Adapter)
Protected methodDispose(Boolean) Releases the unmanaged resources used by the web service and optionally releases the managed resources.
(Inherited from SelfHostingService)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalize Releases the unmanaged resources before the Adapter is reclaimed by GC.
(Inherited from Adapter)
Public methodGetFlashPolicy Gets policy stream for Flash applications.
(Inherited from SelfHostingService)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Protected methodGetServiceAddress Gets an address where the ServiceHost will host the service.
(Inherited from SelfHostingService)
Public methodGetSilverlightPolicy Gets policy stream for Silverlight applications.
(Inherited from SelfHostingService)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodGetUnusedPort Get an unused port number.
(Inherited from SelfHostingService)
Public methodGetUserData Returns information about the current user.
Public methodInitialize Initializes the web service.
(Inherited from SelfHostingService)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Protected methodInitializeServiceHost Initializes the ServiceHost.
(Inherited from SelfHostingService)
Public methodLoadSettings Loads saved web service settings from the config file if the PersistSettings property is set to true.
(Inherited from SelfHostingService)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Protected methodOnDisposed Raises the Disposed event.
(Inherited from Adapter)
Protected methodOnExecutionException Raises the ExecutionException event.
(Inherited from Adapter)
Protected methodOnServiceHostCreated Raises the ServiceHostCreated event.
(Inherited from SelfHostingService)
Protected methodOnServiceHostStarted Raises the ServiceHostStarted event.
(Inherited from SelfHostingService)
Protected methodOnServiceProcessException Raises the ServiceProcessException event.
(Inherited from SelfHostingService)
Protected methodOnStatusUpdate Raises the StatusUpdate event.
(Inherited from Adapter)
Public methodRefreshUserData Refreshes and returns information about the current user.
Public methodResetPassword Resets user password.
Public methodSaveSettings Saves web service settings to the config file if the PersistSettings property is set to true.
(Inherited from SelfHostingService)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Events
 NameDescription
Public eventDisposed Occurs when Adapter is disposed.
(Inherited from Adapter)
Public eventExecutionException Occurs when the IAdapter encounters an Exception during execution.
(Inherited from Adapter)
Public eventServiceHostCreated Occurs when the ServiceHost has been created with the specified Endpoints.
(Inherited from SelfHostingService)
Public eventServiceHostStarted Occurs when the ServiceHost has can process requests via all of its endpoints.
(Inherited from SelfHostingService)
Public eventServiceProcessException Occurs when an Exception is encountered when processing a request.
(Inherited from SelfHostingService)
Public eventStatusUpdate Occurs when the Adapter wants to provide a status update.
(Inherited from Adapter)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks
This list shows the endpoints exposed by SecurityService:
URIProtocol
~/SecurityService.svc/soapSOAP 1.1
~/SecurityService.svc/restREST
Example
This example shows how to consume the REST endpoint of SecurityService using jQuery:
C#
<script src="jquery.js" type="text/javascript" />
<script language="javascript" type="text/javascript">
    $(document).ready(function () { login(); });

    function login() {
        $.get("SecurityService.svc/rest/getuserdata", loginCallback);
    }

    function loginCallback(data) {
        var user = new UserData(data);
        if (!user.isAuthenticated) {
            alert('Access is denied.');
        }
        else {
            alert('Welcome ' + user.firstName + '!');
        }
    }

    function UserData(xml) {
        this.username = $(xml).find('Username').text();
        this.password = $(xml).find('Password').text();
        this.firstName = $(xml).find('FirstName').text();
        this.lastName = $(xml).find('LastName').text();
        this.companyName = $(xml).find('CompanyName').text();
        this.phoneNumber = $(xml).find('PhoneNumber').text();
        this.emailAddress = $(xml).find('EmailAddress').text();
        this.securityQuestion = $(xml).find('SecurityQuestion').text();
        this.securityAnswer = $(xml).find('SecurityAnswer').text();
        this.passwordChangeDateTime = $(xml).find('PasswordChangeDateTime').text();
        this.accountCreatedDateTime = $(xml).find('AccountCreatedDateTime').text();
        this.isDefined = $(xml).find('IsDefined').text() === 'true';
        this.isExternal = $(xml).find('IsExternal').text() === 'true';
        this.isDisabled = $(xml).find('IsDisabled').text() === 'true';
        this.isLockedOut = $(xml).find('IsLockedOut').text() === 'true';
        this.isAuthenticated = $(xml).find('IsAuthenticated').text() === 'true';
        // Retrieve user groups.
        this.groups = groups = new Array();
        $(xml).find('Group').each(function () { groups.push($(this).text()); });
        // Retrieve user roles.
        this.roles = roles = new Array();
        $(xml).find('Role').each(function () { roles.push($(this).text()); });
    }
</script>
See Also