Implemeting IIdentity And IPrincipal

G

Guest

Good Day All

I am currently developing a Web Service that both Windows Forms applications as well as ASP.NET applications will be able to communicate with in order to provide Role Based security. The Web Service is going to return an Identity object and a Principal object to the calling application. I am not able to use Windows accounts as all users of this system don;t have an account on our domain. I decided to design my own Identity and Principal classes that implement the IIdentity and IPrincipal interfaces. This was necessary to hold additional pieces of data that the system needs that aren't present in the Generic Identity or Principal classes

I have everything pieced together but when I test my Web Service I get the following Error Message

Cannot serialize member TestService.Identity of type System.Security.Principal.IIdentity because it is an interface

Here is the Principal Clas

[Serializable
public class FNISPublicPrincipal : IPrincipa


//Holds The List Of Assigned User Role
[System.Xml.Serialization.XmlArray("Roles")
[System.Xml.Serialization.XmlArrayItem( "Role", typeof(string) )
private ArrayList _AssignedRoles
//Adds A User Rol
public void AddUserRole( string role ) { if ( role != string.Empty ) { _AssignedRoles.Add( role.Trim() ); }

//Holds The Identity Object That This Principal Is Associated Wit
private IIdentity _Identity
public IIdentity Identity { get { return _Identity; }

public FNISPublicPrincipal(


//Initialize The ArrayLis
this._AssignedRoles = new ArrayList()



public FNISPublicPrincipal( FNISPrivatePrincipal p


//Assign Identity Value
_Identity = p.Identity

//Initialize The ArrayLis
this._AssignedRoles = new ArrayList( p.GetRoles() )



public bool IsInRole ( string role


bool outcome = this._AssignedRoles.Contains( role.Trim() )
return outcome





Is there anyway I can get this to work? I have been on Google for that last few hours but haven't found anything. Any help is appreciated

Thanks

Dan
 
B

Brad Williams

How about changing type for _Identity to a serializable class that
implements IIdentity?

Brad Williams
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top