Customer IPrincial and IIdentity

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Customer IPrincial and IIdentity

    Hi,

    I need to push some more information than just username and roles in
    the IPrincipal implementation.

    For this, I wrote the following code (during authentication):

    MyIdentity mi = new MyIdentity(....);
    MyPrincipal mp = new MyPrincipal(....);

    Context.User = mp;
    FormsAuthentication.SetAuthCookie(...);

    However, everytime I check for Context.User, I get a
    GenericPrincipal. How can I have my own MyPrincipal come into
    existence?



    CHeers,
    Gaurav Vaish
    [url]http://mastergaurav.org[/url]
    [url]http://mastergaurav.blogspot.com[/url]
    ----------------------------

    MasterGaurav Guest

  2. Similar Questions and Discussions

    1. Iprincipal & IIdentity problem
      HI All, I ma new to .NET. I was a java programmer for the past 2 years, and now shifted to .NET. My company (A product based company) is rewritng...
    2. Marshaling IIdentity via web services.
      Is there a way to marshal an object via a web service that implements IIdentity? Thanks
    3. how to add another property to class inheriting from IIdentity?
      Hello peoples this is a question regarding security of windows application I want to add another property (the UserID) to...
    4. Pay for Customer Support?
      We have to pay for Customer Support? We have to pay for Beta versions? Macromedia getting greedy? I tried installing Director MX 2004 trial on...
    5. Finding a NEW customer
      I am trying to create a multiple find in a script for the purpose of finding a customer base that defined as NEW. New is defined as a customer...
  3. #2

    Default Re: Customer IPrincial and IIdentity

    You must re-assign your custom principal to the thread identity for each
    returning request. Use a cookie to store any specific information, grab that
    info from the cookie in the Applicatin_Authenticate event, then generate a
    custom principal and assign it to the threads context
    (HttpContext.Current.User)

    --

    - Paul Glavich
    ASP.NET MVP
    ASPInsider ([url]www.aspinsiders.com[/url])


    "MasterGaurav" <gaurav.vaish@gmail.com> wrote in message
    news:1112610412.603357.318560@o13g2000cwo.googlegr oups.com...
    > Hi,
    >
    > I need to push some more information than just username and roles in
    > the IPrincipal implementation.
    >
    > For this, I wrote the following code (during authentication):
    >
    > MyIdentity mi = new MyIdentity(....);
    > MyPrincipal mp = new MyPrincipal(....);
    >
    > Context.User = mp;
    > FormsAuthentication.SetAuthCookie(...);
    >
    > However, everytime I check for Context.User, I get a
    > GenericPrincipal. How can I have my own MyPrincipal come into
    > existence?
    >
    >
    >
    > CHeers,
    > Gaurav Vaish
    > [url]http://mastergaurav.org[/url]
    > [url]http://mastergaurav.blogspot.com[/url]
    > ----------------------------
    >

    Paul Glavich [MVP ASP.NET] Guest

  4. #3

    Default Re: Customer IPrincial and IIdentity

    Cookie!
    Is there no other way? Putting it in session... would that work fine?


    Cheers,
    Gaurav Vaish
    [url]http://mastergaurav.org[/url]
    [url]http://mastergaurav.blogspot.com[/url]
    ----------------------------

    MasterGaurav Guest

  5. #4

    Default Re: Customer IPrincial and IIdentity

    But how are distinct Sessions identified? Yep, with cookies :)

    If you put that info into a cookie then you most certainly should encrypt
    and MAC protect it so it can't be viewed or modified by the end user (or
    an attacker). Beware, the more security code you write the less secure your
    app tends to be.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]


    > Cookie!
    > Is there no other way? Putting it in session... would that work fine?
    > Cheers,
    > Gaurav Vaish
    > [url]http://mastergaurav.org[/url]
    > [url]http://mastergaurav.blogspot.com[/url]
    > ----------------------------


    Brock Allen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139