示例#1
0
 public static IAppBuilder UseUAEPassAuthentication(this IAppBuilder app, string clientId, string clientSecret, uaePassEnum.authenticationType AuthenticationType, uaePassEnum.localeType LocaleType, List <string> ScopeList, string CallbackPath = "")
 {
     return(app.UseUAEPassAuthentication(new UAEPassAuthenticationOptions(AuthenticationType, LocaleType, ScopeList, CallbackPath)
     {
         ClientId = clientId,
         ClientSecret = clientSecret
     }));
 }
        /// <summary>
        ///     Initializes a new <see cref="GoogleAuthenticationOptions" />
        /// </summary>
        public UAEPassAuthenticationOptions(uaePassEnum.authenticationType AuthenticationType, uaePassEnum.localeType LocaleType, List <string> ScopeList, string callBackPath = "") : base("UAEPass")
        {
            Caption = Constants.DefaultAuthenticationType;

            //SET CALL BACK PATH
            CallbackPath = new PathString("/uaepass");

            if (!string.IsNullOrEmpty(callBackPath))
            {
                if (callBackPath.Substring(0, 1) != "/")
                {
                    callBackPath = "/" + callBackPath;
                }

                CallbackPath = new PathString(callBackPath);
            }

            AuthenticationMode = AuthenticationMode.Passive;
            BackchannelTimeout = TimeSpan.FromSeconds(60);

            //SET END POINT URLs
            if (AuthenticationType == uaePassEnum.authenticationType.Production)
            {
                Caption          = "UAE Pass Authentication";
                UAEPassEndPoints = new UAEPassAuthenticationEndpoints()
                {
                    AuthorizationEndpoint = Constants.DefaultProductionAuthorizationEndpoint,
                    TokenEndpoint         = Constants.DefaultProductionTokenEndpoint,
                    UserInfoEndpoint      = Constants.DefaultProductionUserInfoEndpoint
                };
            }
            else
            {
                Caption          = "UAE Pass Authentication - QA";
                UAEPassEndPoints = new UAEPassAuthenticationEndpoints()
                {
                    AuthorizationEndpoint = Constants.DefaultQAAuthorizationEndpoint,
                    TokenEndpoint         = Constants.DefaultQATokenEndpoint,
                    UserInfoEndpoint      = Constants.DefaultQAUserInfoEndpoint,
                };
            }

            //SET LOCALE
            if (LocaleType == uaePassEnum.localeType.English)
            {
                Locale = "en";
            }
            else
            {
                Locale = "ar";
            }

            //SET SCOPES
            Scope = ScopeList;
        }