TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sachin Singh
7
55.8k
81.1k
Custom Role provider vs Custom Authorize attribute.
Jul 16 2020 12:11 PM
we can set Principle while creating our Custom authorizing attribute like
public
class
BasicAuthenticationAttribute : AuthorizationFilterAttribute
{
//todo
IPrincipal principal =
new
GenericPrincipal(identity, UserDetails.Roles.Split(
','
));
}
and we can also create CustomRoleProvider like below
public
class
UserRoleProvider : RoleProvider
{
public
override
string
[] GetRolesForUser(
string
username)
{
using
(EmployeeContext _Context=
new
EmployeeContext())
{
var userRoles =
//todo
return
userRoles;
}
}
}
}
My question is what is the difference between the two and when to use one over another or both are same?
Reply
Answers (
1
)
Best google font
How to remove Jwt token authentication on method level