Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Security.Principal
Imports System.Text

Public Class MyPrincipal
    Implements IPrincipal
    Private mIdentity As MyIdentity
    Private mRoles As IList(Of String) = New List(Of String)

    Public Sub New(ByVal identity As MyIdentity)
        mIdentity = identity
    End Sub

    Public ReadOnly Property MyIdentity() As MyIdentity
        Get
            Return mIdentity
        End Get
    End Property

    ReadOnly Property Identity() As IIdentity Implements IPrincipal.Identity
        Get
            Return mIdentity
        End Get
    End Property

    Public Function IsInRole(ByVal role As String) As Boolean Implements IPrincipal.IsInRole
        Return Array.BinarySearch(Of String)(mIdentity.Ticket.Roles, role) >= 0
    End Function
End Class
