[Last Call] Learn how to a build a cloud-first strategyRegister Now


does not implement interface member 'Microsoft.Practices.EnterpriseLibrary.Security.IAuthorizationProvider.Authorize(System.Security.Principal.IPrincipal, System.Collections.Generic.List<string>)

Posted on 2007-10-11
Medium Priority
Last Modified: 2009-12-16
Ok, bare with me. I know this is probably syntax basics but I'm still learning the advanced sh**.  So, I took this class in the Enterprise Library 3.1 called AuthorizationProvider and created a new one which will be custom for us.  I get this error though but not sure how to fix this.  It's set to use the IAuthorizationProvider just as the implementation of the original AuthorizationProvider.cs was doing.  It is because of my new class's name that I get this error when it's trying to use the IAuthorizationProvider class?

 Heres' what I have at the top of my new custom class:

1    namespace Microsoft.Practices.EnterpriseLibrary.Security
3    {
5        /// <summary>
6        /// Abstract implementation of the <see cref="IAuthorizationProvider"/> interface.
7        /// </summary>
8        public abstract class TESTAuthorizationProvider : IAuthorizationProvider
10       {
  get this error: 'Microsoft.Practices.EnterpriseLibrary.Security.AuthorizationProvider' does not implement interface member 'Microsoft.Practices.EnterpriseLibrary.Security.IAuthorizationProvider.Authorize(System.Security.Principal.IPrincipal, System.Collections.Generic.List<string>)'

In the Interface it has the Authorize method defined like so:

1        public interface IAuthorizationProvider
2        {
3            /// <summary>
4            /// Evaluates the specified authority against the specified context.
5            /// </summary>
6            /// <param name="principal">Must be an <see cref="IPrincipal"/> object.</param>
7            /// <param name="context">Name of the rule to evaluate.</param>
8            /// <returns><strong>True</strong> if the expression evaluates to true,
9            /// otherwise <strong>false</strong>.</returns>
10           bool Authorize(IPrincipal principal, string context);
12       }
 and in my new custom class, I want to override and create my own implementation because I will be required a different set of arguments.  So in my TESTAuthorizationProvider I have this Authorize method I've defined:

       public bool Authorize(IPrincipal principal, List<string> rightsRequested)
            ...etc. Notice that I'm accepting not a string but a generic list.  So do I need to override Authorize method from the interface or something to get rid of this error?
Question by:dba123
  • 2
LVL 22

Expert Comment

ID: 20057770
put your cursor on IAuthorizationProvider and click anywhere in the string.
you should bet a little purplish block under the first letter. if you click on that you should get a dropdown asking how to implement just select the first it the list and it will stub in all code for that interface and should get rid of that error

Accepted Solution

thuannguy earned 2000 total points
ID: 20057836
Yes, you need to implement all methods of the implemented interface. In addition, the signature of the methods must be the same as that of the implemented interface.
LVL 22

Expert Comment

ID: 20090518
umm i'm not usually a point grubber but, what the heck! the second post was a reiteration of mine. b/c if you implement the signatures are setup for you.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Integration Management Part 2
Loops Section Overview
Suggested Courses

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question