Beispiel #1
0
        public string GetLoginUrlForDelegateAuthIdAndResourceUrl(string resourceUrl, int authId)
        {
            var idHash           = learningHubSsoSecurityService.GenerateHash(authId.ToString());
            var loginQueryString =
                ComposeLoginQueryString(ClientCode, authId, idHash, resourceUrl);

            var loginEndpoint = config.GetLearningHubAuthApiLoginEndpoint();

            return(AuthBaseUrl + loginEndpoint + loginQueryString);
        }
        public void Setup()
        {
            var config = A.Fake <IConfiguration>();

            userDataService = A.Fake <IUserDataService>();
            learningHubSsoSecurityService = A.Fake <ILearningHubSsoSecurityService>();

            A.CallTo(() => config["LearningHubSSO:BaseUrl"]).Returns("www.example.com");
            A.CallTo(() => config["LearningHubSSO:ClientCode"]).Returns("test");
            A.CallTo(() => config["LearningHubSSO:LoginEndpoint"]).Returns("/insert-log");
            A.CallTo(() => config["LearningHubSSO:LinkingEndpoint"]).Returns("/to-the-past");

            A.CallTo(() => learningHubSsoSecurityService.VerifyHash("56789", "invalid-hash")).Returns(false);
            A.CallTo(() => learningHubSsoSecurityService.VerifyHash("12345", "valid-hash")).Returns(true);
            A.CallTo(() => learningHubSsoSecurityService.GenerateHash(A <string> ._)).Returns("hash_brown");

            learningHubLinkService = new LearningHubLinkService(learningHubSsoSecurityService, userDataService, config);
        }