Beispiel #1
0
        public IntegrationService(ICacheWrapper appCache, CoudSuiteWebClient webClient, IProgressConnection connection, IProgressConfiguration progressConfiguration)
        {
            this._appCache              = appCache;
            this._connection            = connection;
            this._progressConfiguration = progressConfiguration;
            this._tokenObject           = ApplicationCookieUtilities.Principal(HttpContext.Current.User, out _);
            this._appCache.TokenObject  = this._tokenObject;

            _supportedRepositories = new Dictionary <string, SupportedRespository>
            {
                {
                    "icsw", new SupportedRespository {
                        IdmEntityType = "Item_Images", IdmRepository = "icsw", Formatter = "@Product_Number = \"{0}\""
                    }
                }
            };

            this._bearerToken = StringProtector.Unprotect(ApplicationCookieUtilities.BearerTokenValue(HttpContext.Current.User), new ProgressConfiguration().ApplicationEncryptKey,
                                                          new ProgressConfiguration().ApplicationEncryptIv);
        }
Beispiel #2
0
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            var nLogLogger = new NLogLogger(BearerTokenAddExceptionText);

            try
            {
                if (new ProgressConfiguration().SSoEnabled&& actionExecutedContext.Response != null)
                {
                    actionExecutedContext.Response.Content.Headers.Remove(ApplicationCookieUtilities.BearerToken);
                    var bearerToken = BearerToken.GetBearerToken(nLogLogger);
                    if (bearerToken != null)
                    {
                        bearerToken = StringProtector.Protect(bearerToken, new ProgressConfiguration().ApplicationEncryptKey,
                                                              new ProgressConfiguration().ApplicationEncryptIv);
                        actionExecutedContext.Response.Content.Headers.Add(ApplicationCookieUtilities.BearerToken,
                                                                           bearerToken);
                    }
                }
            }
            catch (Exception ex)
            {
                nLogLogger.ErrorException(ex.Message, ex);
            }
        }