Пример #1
0
 private static List<RoleProvider> CreateRoleProviders(List<AuthService> authServices)
 {
     var wellcomeDelegated = authServices.GetByIdPart("wellcome-delegated-login");
     return new List<RoleProvider>
     {
         new RoleProvider(wellcomeDelegated.CustomerId, wellcomeDelegated.ModelId, "{ Some CAS or OAuth details }", 
             "s3://wellcome/path-to-sso-backchannel-creds-if-required")
     };
 }
Пример #2
0
        private static List<Role> CreateRoles(List<Customer> customers, List<AuthService> authServices, Dictionary<string, string> roleAuthService)
        {
            int wellcome = customers.GetByName("wellcome").ModelId;
            int iiifly = customers.GetByName("iiifly").ModelId;
            
            var roles = new List<Role>
            {
                new Role(wellcome, "clickthrough", "Click through",
                    "Role for DLCS-enforced auth with no delegation", new [] { "Requires Registration", "reqreg"}),
                new Role(wellcome, "clinical", "Clinical Delegate to wellcomelibrary.org",
                    "Role for DLCS-enforced auth with delegation to customer", new [] { "Clinical Images", "Healthcare professional" }),
                new Role(wellcome, "staff", "Staff Delegate to wellcomelibrary.org",
                    "Role for DLCS-enforced auth with delegation to customer", new [] { "Wellcome Staff Member" }),
                new Role(wellcome, "restricted", "Restricted Delegate to wellcomelibrary.org",
                    "Role for DLCS-enforced auth with delegation to customer", new [] { "restricted" }),

                new Role(iiifly, "clickthrough", "Click through",
                    "Role for DLCS-enforced auth with no delegation", new [] { "acceptterms" }),
            };

            roleAuthService.Add(roles[0].Id, authServices.GetByIdPart("wellcome-clickthrough-login").Id);
            roleAuthService.Add(roles[1].Id, authServices.GetByIdPart("wellcome-delegated-login").Id);
            roleAuthService.Add(roles[2].Id, authServices.GetByIdPart("wellcome-delegated-login").Id);
            roleAuthService.Add(roles[3].Id, authServices.GetByIdPart("wellcome-delegated-login").Id);
            roleAuthService.Add(roles[4].Id, authServices.GetByIdPart("iiifly-clickthrough-login").Id);
            return roles;
        }
Пример #3
0
        private static List<AuthService> CreateAuthServices(List<Customer> customers, Dictionary<string, List<string>> authServiceParentChild)
        {
            int wellcome = customers.GetByName("wellcome").ModelId;
            int iiifly = customers.GetByName("iiifly").ModelId;
            var authServices = new List<AuthService>
            {
                new AuthService(wellcome, "wellcome-clickthrough-login", "clickthrough", "http://iiif.io/api/auth/0/login", 0,
                    "Terms and Conditions", "<p>clickthrough...</p>", 
                    "Terms and Conditions", "<p>More detailed info</p>", "Accept terms"),
                new AuthService(wellcome, "wellcome-clickthrough-token", "clickthrough-token", "http://iiif.io/api/auth/0/token", 1800,
                    "token service", null, null, null, null),
                new AuthService(wellcome, "wellcome-clickthrough-logout", "clickthrough-logout", "http://iiif.io/api/auth/0/logout", 0,
                    "Forget terms", null, null, null, null),

                new AuthService(wellcome, "wellcome-delegated-login", "delegated-login", "http://iiif.io/api/auth/0/login", 0,
                    "Log in to view protected material", "<p>More detailed text for login prompt in UV</p>", 
                    null, null, "Log in"),
                new AuthService(wellcome, "wellcome-delegated-token", "delegated-token", "http://iiif.io/api/auth/0/token", 1800,
                    "token service", null, null, null, null),
                new AuthService(wellcome, "wellcome-delegated-logout", "delegated-logout", "http://iiif.io/api/auth/0/logout", 0,
                    "Log out", null, null, null, null),

                new AuthService(iiifly, "iiifly-clickthrough-login", "clickthrough", "http://iiif.io/api/auth/0/login", 0,
                    "Terms and Conditions", "<p>clickthrough...</p>",
                    "Terms and Conditions", "<p>More detailed info</p>", "Accept terms"),
                new AuthService(iiifly, "iiifly-clickthrough-token", "clickthrough-token", "http://iiif.io/api/auth/0/token", 1800,
                    "token service", null, null, null, null),
                new AuthService(iiifly, "iiifly-clickthrough-logout", "clickthrough-logout", "http://iiif.io/api/auth/0/logout", 0,
                    "Forget terms", null, null, null, null),
            };

            authServiceParentChild.Add(
                    authServices.GetByIdPart("wellcome-clickthrough-login").Id,
                        new List<string> {  authServices.GetByIdPart("wellcome-clickthrough-token").Id,
                                            authServices.GetByIdPart("wellcome-clickthrough-logout").Id });

            authServiceParentChild.Add(
                    authServices.GetByIdPart("wellcome-delegated-login").Id,
                        new List<string> {  authServices.GetByIdPart("wellcome-delegated-token").Id,
                                            authServices.GetByIdPart("wellcome-delegated-logout").Id });

            authServiceParentChild.Add(
                    authServices.GetByIdPart("iiifly-clickthrough-login").Id,
                        new List<string> {  authServices.GetByIdPart("iiifly-clickthrough-token").Id,
                                            authServices.GetByIdPart("iiifly-clickthrough-logout").Id });

            return authServices;
        }