473,499 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom IPrincipal with a Generic

I'm working on a custom IPrincipal.

Sometimes I use the "good ole" MS system of strings.

Lately, I've been storing my roles and rights as Guids.

Check out the below code.

I'm not sure if this is the way to go or not.

What stinks is that I don't see how to keep IRolesAndRightsPrincipalT<Tto
be ~only string or guid based. ( The "where" seems to only like base class
stuff for trying to constrain <T>)

Aka, somebody could right a

public interface IRolesAndRightsPrincipalABC :
IRolesAndRightsPrincipalT<Employee>
{

}

which really doesn't make any sense.

This is a very , very "top level" interface I'm trying to create, so that it
fills IPrincipal needs throughout the company.
There might be 20-25 concrete implementations. ( << Don't ask )

I don't know. I'm just looking for some "This is dumb" or "That's ok"
comments.

public interface IRolesAndRightsPrincipalT<T:
System.Security.Principal.IPrincipal

{

bool IsInRole(T role);

bool IsInAnyRole(T[] roles);

bool IsInAllRoles(T[] roles);

bool HasRight(T right);

bool HasAnyRight(T[] rights);

bool HasAllRights(T[] rights);

}

public interface IRolesAndRightsPrincipalString :
IRolesAndRightsPrincipalT<string>

{

}

public interface IRolesAndRightsPrincipalGuid :
IRolesAndRightsPrincipalT<System.Guid>

{

}
Jun 26 '07 #1
0 1785

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1458
by: Nick | last post by:
My client uses a SQL Database to store their usernames and passwords, and I do not believe they have AD...no big deal... I wrote a class to create a generic identity and generic principal so that...
2
4963
by: Boris Condarco | last post by:
Hi gurus, I was reading some documentation about security in .NET Framework, it mention that it is possible to make custom Role Based security for example: check the authentication with Windows...
3
7239
by: David B. Bitton | last post by:
For some odd reason, despite the fact that I assign my own custom IPrincipal to the HttpContext.User property in an HttpApplication.AuthenticateRequest event handler inside of an IHttpModule,...
2
4695
by: lucd | last post by:
Hello, I am currently playing with form authentication & role based security on a web application. As seen in the starter kit Time tracker, I setup a custom identity class (CustomPrincipal)...
2
2010
by: CodeCowboy | last post by:
I'm sure some of you have done this before and I've been perusing through the forum trying to find some uncomplicated solution. I am trying to extend the existing user.identity object. I would...
0
908
by: Mythran | last post by:
We have a class that Implements IPrincipal (System.Security.Principal.IPrincipal). We have a business logic class library assembly that checks the Principal object for role information to see if...
1
6297
by: Stu | last post by:
Hi, Im using vis studio 2003 and I think wse is out of the question as clients could be using java which doesnt support it. So I managed to find some code which allows you to develop a custom...
0
1829
by: sloan | last post by:
I've been reading this article: http://msdn2.microsoft.com/EN-US/library/aa302401.aspx Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication (the...
7
10886
by: Linda Liu[MSFT] | last post by:
Hi George, I have downloaded your sample solution and built it on my machine. I got a compilation error indicating that the type of "CustomResources" doesn't exist in the following xaml code: ...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.