<p>Encouraged by SO, I'm trying to write an ASP.NET site that uses OpenID for user authentication.  It's a regular WinForms site (not MVC.NET), using the <a href="http://code.google.com/p/dotnetopenid/" rel="nofollow noreferrer">DotNetOpenId</a> library for authentication.</p>

<p>Is it safe for me to permit/deny administrative functions on the site by simply comparing the current session's "ClaimedID" (as returned in the OpenIdLogin_LoggedIn event, as member DotNetOpenId.RelyingParty,OpenIdEventArgs.Response.ClaimedIdentifier) to a known administrator's OpenID (i.e. mine)?</p>

<p>If so, is it safe for this ID to be visible (e.g. in open source code), or should it be "hidden" in a configuration file or a database row?  (I know it's better design to make it configurable, my question is just about safety.)</p>

[{'answer_id': 57060, 'author': 'Jarrett Meyer', 'author_id': 5834, 'author_profile': 'https://Stackoverflow.com/users/5834', 'pm_score': 2, 'selected': False, 'text': '<p>My solution is to follow the same idea of the Roles table. After you\'ve authenticated the user, look up that user\'s roles. If the user has role "Administrator" in the UserRoles table, then they can do whatever the Administrator can do.</p>\n\n<p>I don\'t broadcast open ID\'s in my app. They\'re stored in the table. On every action result, I\'m hitting the Users table, since I have also modified mine to store various user state information. With the exception of the home page, there is going to be some user information that I need from that table. I\'m using LINQ, so I include the .LoadWith() to load the User with his list of roles when it serializes.</p>\n'}, {'answer_id': 373685, 'author': 'Andrew Arnott', 'author_id': 46926, 'author_profile': 'https://Stackoverflow.com/users/46926', 'pm_score': 3, 'selected': True, 'text': "<p>Jarrett makes some good comments about using database tables.</p>\n\n<p>Just to answer another one of your questions, no, it's not a confidentiality thing to put your OpenID in your code generally.  If setting up roles seems overkill for your site, a simple equality check against your ClaimedIdentifier is just perfect.  </p>\n"}]
['https://Stackoverflow.com/questions/56944', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4540/']