# Raccoon.Devkits.SessionAuthorization **Repository Path**: lhrbu/Raccoon.Devkits.SessionAuthorization ## Basic Information - **Project Name**: Raccoon.Devkits.SessionAuthorization - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-26 - **Last Updated**: 2022-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### Raccoon.Devkits.SessionAuthorization - Install Redis first, this package use redis as its session backend - Install Package: ```shell dotnet add package Raccoon.Devkits.SessionAuthorization ``` - Add Dependency Inject: ```c# services.AddSessionAuthorization( Action redisSetupAction, Action? sessionOptionsAction = null) ``` Implement `ISensitiveDataPersistent` then inject, user name should be unique: ```c# services.AddSingleton() ``` - Enable in app pipeline, after app.MapController() ```c# app.UseSessionAuthorization( TimeSpan? rememberMeTimeSpan = null) // default is 7 days. - Add Role RoleAuthorization attribute: ```c# [RoleAuthorization("Browser","Admin")] ``` - Sql Server SensitiveDataPersistent: ```shell dotnet add package Raccoon.Devkits.SessionAuthorization.SqlServer ``` ```c# builder.Services.AddSqlServerSensitivePersistent(options => options.UseSqlServer("xxx"));