Refactoring authentication to support server-side Blazor using a seamless login flow.
This commit is contained in:
		| @ -32,8 +32,7 @@ namespace Oqtane.Services | ||||
|  | ||||
|         public async Task<Alias> GetAliasAsync(int AliasId) | ||||
|         { | ||||
|             List<Alias> aliases = await http.GetJsonAsync<List<Alias>>(apiurl); | ||||
|             return aliases.Where(item => item.AliasId == AliasId).FirstOrDefault(); | ||||
|             return await http.GetJsonAsync<Alias>(apiurl + "/" + AliasId.ToString()); | ||||
|         } | ||||
|  | ||||
|         public async Task AddAliasAsync(Alias alias) | ||||
|  | ||||
| @ -8,6 +8,7 @@ namespace Oqtane.Services | ||||
|     { | ||||
|         Task<List<Module>> GetModulesAsync(int PageId); | ||||
|         Task<List<Module>> GetModulesAsync(int SiteId, string ModuleDefinitionName); | ||||
|         Task<Module> GetModuleAsync(int ModuleId); | ||||
|         Task AddModuleAsync(Module module); | ||||
|         Task UpdateModuleAsync(Module module); | ||||
|         Task DeleteModuleAsync(int ModuleId); | ||||
|  | ||||
| @ -7,6 +7,7 @@ namespace Oqtane.Services | ||||
|     public interface IPageService | ||||
|     { | ||||
|         Task<List<Page>> GetPagesAsync(int SiteId); | ||||
|         Task<Page> GetPageAsync(int PageId); | ||||
|         Task AddPageAsync(Page page); | ||||
|         Task UpdatePageAsync(Page page); | ||||
|         Task DeletePageAsync(int PageId); | ||||
|  | ||||
| @ -10,6 +10,8 @@ namespace Oqtane.Services | ||||
|  | ||||
|         Task<User> GetUserAsync(int UserId); | ||||
|  | ||||
|         Task<User> GetUserAsync(string Username); | ||||
|  | ||||
|         Task AddUserAsync(User user); | ||||
|  | ||||
|         Task UpdateUserAsync(User user); | ||||
|  | ||||
| @ -39,6 +39,11 @@ namespace Oqtane.Services | ||||
|             return modules.ToList(); | ||||
|         } | ||||
|  | ||||
|         public async Task<Module> GetModuleAsync(int ModuleId) | ||||
|         { | ||||
|             return await http.GetJsonAsync<Module>(apiurl + "/" + ModuleId.ToString()); | ||||
|         } | ||||
|  | ||||
|         public async Task AddModuleAsync(Module module) | ||||
|         { | ||||
|             await http.PostJsonAsync(apiurl, module); | ||||
|  | ||||
| @ -30,6 +30,11 @@ namespace Oqtane.Services | ||||
|             return pages.OrderBy(item => item.Order).ToList(); | ||||
|         } | ||||
|  | ||||
|         public async Task<Page> GetPageAsync(int PageId) | ||||
|         { | ||||
|             return await http.GetJsonAsync<Page>(apiurl + "/" + PageId.ToString()); | ||||
|         } | ||||
|  | ||||
|         public async Task AddPageAsync(Page page) | ||||
|         { | ||||
|             await http.PostJsonAsync(apiurl, page); | ||||
|  | ||||
| @ -32,17 +32,7 @@ namespace Oqtane.Services | ||||
|  | ||||
|         public async Task<Site> GetSiteAsync(int SiteId) | ||||
|         { | ||||
|             List<Site> sites = await http.GetJsonAsync<List<Site>>(apiurl); | ||||
|             Site site; | ||||
|             if (sites.Count == 1) | ||||
|             { | ||||
|                 site = sites.FirstOrDefault(); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 site = sites.Where(item => item.SiteId == SiteId).FirstOrDefault(); | ||||
|             } | ||||
|             return site; | ||||
|             return await http.GetJsonAsync<Site>(apiurl + "/" + SiteId.ToString()); | ||||
|         } | ||||
|  | ||||
|         public async Task AddSiteAsync(Site site) | ||||
|  | ||||
| @ -35,8 +35,12 @@ namespace Oqtane.Services | ||||
|  | ||||
|         public async Task<User> GetUserAsync(int UserId) | ||||
|         { | ||||
|             List<User> users = await http.GetJsonAsync<List<User>>(apiurl); | ||||
|             return users.Where(item => item.UserId == UserId).FirstOrDefault(); | ||||
|             return await http.GetJsonAsync<User>(apiurl + "/" + UserId.ToString()); | ||||
|         } | ||||
|  | ||||
|         public async Task<User> GetUserAsync(string Username) | ||||
|         { | ||||
|             return await http.GetJsonAsync<User>(apiurl + "/name/" + Username); | ||||
|         } | ||||
|  | ||||
|         public async Task AddUserAsync(User user) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker