How to Implement Custom Membership and Roles in Oracle Database

906 views Asked by At

How to implement Custom Membership and Roles in Oracle DB. are we need to write the overload for the Membership Function ? If yes then How ?

Where is the Database Schema for Membership and roles for oracle.

1

There are 1 answers

2
Hans Leautaud On

You should use a custom membership provider. When you create a class which inherits from membershipprovider it should implment all the right classes automatically. You can also override the membershipuser if you want to add some custom features.

public class CustomMembershipProvider : System.Web.Security.MembershipProvider

I would use the custom membership provider just as a container so i would use another class to handle all the database calls and such.

    public override string GetPassword(string username, string answer)
    {
        return ProfileManager.GetPassword(username);
    }

In ProfileManager for instance:

    public static string GetPassword(string username)
    {
        if (!username.Contains("custom\\")) return String.Empty;

        MijnGazelleEntities container = new CustomEntities();
        Users gebruiker = container.Users.FirstOrDefault(g => g.Email == username.Replace("mijngazelle\\", String.Empty));
        string password = gebruiker != null ? gebruiker.Password : String.Empty;

        container.Connection.Close();
        return password;
    }