Listing E
'##############################################################################
' Author: Kevin Koch
' Description:  This class is used to provide common functionality for
'               authentication and for creating the security contexts
'              required by John's application
'##############################################################################
 
 
 
 
Imports System.Configuration.ConfigurationSettings
 
 
Public Class WSUtil
 
 
    '================================================================================================================================
    ' Authenticates a web service consumer's security context values
    '================================================================================================================================
    Friend Function Authenticate(ByVal SecureCtx As OrderSecurityContext) As Boolean
        Dim Authenticated As Boolean = False
 
 
        If SecureCtx Is Nothing Then Return False
 
 
        If SecureCtx.WSToken = AppSettings("JohnWsToken") Then
            Authenticated = True
        End If
 
 
        Return Authenticated
    End Function
 
 
 
 
    Public Shared Function GetBookSecurityContext() As BookProxy.BookSecurityContext
        Dim SecureCtx As New BookProxy.BookSecurityContext()
        SecureCtx.ClientId = AppSettings("MyClientId")
        SecureCtx.WSToken = AppSettings("MyWSToken")
 
 
        Return SecureCtx
    End Function
 
 
    Public Shared Function GetOrderSecurityContext() As OrderProxy.OrderSecurityContext
        Dim SecureCtx As New OrderProxy.OrderSecurityContext()
        SecureCtx.ClientId = AppSettings("MyClientId")
        SecureCtx.WSToken = AppSettings("MyWSToken")
 
 
        Return SecureCtx
    End Function
 
 
End Class