{"action":"created","issue":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1418","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1418/labels{/name}","comments_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1418/comments","events_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1418/events","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/1418","id":82470464,"number":1418,"title":"Customer Authentication and  return URL","user":{"login":"moiseyo","id":5314730,"avatar_url":"https://avatars.githubusercontent.com/u/5314730?v=3","gravatar_id":"","url":"https://api.github.com/users/moiseyo","html_url":"https://github.com/moiseyo","followers_url":"https://api.github.com/users/moiseyo/followers","following_url":"https://api.github.com/users/moiseyo/following{/other_user}","gists_url":"https://api.github.com/users/moiseyo/gists{/gist_id}","starred_url":"https://api.github.com/users/moiseyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moiseyo/subscriptions","organizations_url":"https://api.github.com/users/moiseyo/orgs","repos_url":"https://api.github.com/users/moiseyo/repos","events_url":"https://api.github.com/users/moiseyo/events{/privacy}","received_events_url":"https://api.github.com/users/moiseyo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-29T15:23:10Z","updated_at":"2015-05-29T19:45:25Z","closed_at":null,"body":"Using Sample  \"User Service\"  I was able to make authentication  with customized provider.\r\n\r\nThe code  i tested \r\nDoes not return to call page \r\n\r\nI trued to create AuthenticateResult  3 diffrent ways and no good result \r\n\r\nIf   I use  in memory authentication all works as expected \r\n\r\n\r\nWhat did I miss ?\r\n------------------------------------------------\r\n\r\n  public async override System.Threading.Tasks.Task<Thinktecture.IdentityServer.Core.Models.AuthenticateResult>\r\n            AuthenticateLocalAsync(string username, string password, Thinktecture.IdentityServer.Core.Models.SignInMessage message)\r\n        {\r\n            //string file_name = @\"c:\\temp\\short\\1.ser\";\r\n            //FileStream fs = new FileStream(file_name, FileAccess.Write);\r\n\r\n            var form = await ctx.Request.ReadFormAsync();\r\n            var clientid = form[\"clientid\"];\r\n            Thinktecture.IdentityServer.Core.Models.AuthenticateResult result;\r\n\r\n\r\n            IList<Claim> claimCollection;\r\n\r\n            try\r\n            {\r\n\r\n \r\n                UniversalTaxSystems.Security.User CurrentUser = UniversalTaxSystems.Security.User.GetUser(Guid.Empty);\r\n                Int32 ClientID = Int32.Parse(clientid);\r\n                String UserName = username;\r\n                String Password = password;\r\n                UniversalTaxSystems.Security.UserValidateFailureReason Reason = new UniversalTaxSystems.Security.UserValidateFailureReason();\r\n                var login = UniversalTaxSystems.Security.User.Validate(ClientID, UserName,\r\n                    Password, ref CurrentUser, ref Reason, \"xxxxx\");\r\n\r\n                if (login)\r\n                {\r\n                        claimCollection = new List<Claim>\r\n                    {\r\n                        new Claim(ClaimTypes.Name, username)\r\n                        , new Claim(ClaimTypes.Country, \"USA\")\r\n                        , new Claim(ClaimTypes.Gender, \"M\")\r\n                        , new Claim(ClaimTypes.Surname, CurrentUser.LastName)\r\n                        , new Claim(ClaimTypes.Email,CurrentUser.EmailAddress )\r\n                        , new Claim(ClaimTypes.Role, CurrentUser.AssignedRoles.First().ToString())\r\n                    };\r\n\r\n                    ExternalIdentity externalidentity = new ExternalIdentity();\r\n\r\n                \r\n                    externalidentity.Claims = claimCollection;\r\n                    externalidentity.Provider = \"CHHSFS\";\r\n                    externalidentity.ProviderId = \"cchsfs\";\r\n                    Uri redirect = new Uri(message.ReturnUrl);\r\n\r\n\r\n                    //result = new Thinktecture.IdentityServer.Core.Models.AuthenticateResult(redirect.PathAndQuery, username, username, claimCollection);\r\n                    result = new Thinktecture.IdentityServer.Core.Models.AuthenticateResult( username, username, claimCollection);\r\n                  //  result = new Thinktecture.IdentityServer.Core.Models.AuthenticateResult( redirect.PathAndQuery,externalidentity);\r\n\r\n                }\r\n                else\r\n                {\r\n\r\n                    result = await base.AuthenticateLocalAsync(username + \"XXXXXXX\", password + \"YYYYY\", message);\r\n\r\n                }\r\n\r\n                // result = await base.AuthenticateLocalAsync(\"alice\", \"alice\", message);\r\n\r\n                //   \r\n\r\n                //result.User.Claims = claimCollection;\r\n\r\n                return result;\r\n            }\r\n            catch (Exception ext )\r\n            {\r\n                var mess = ext.Message;\r\n            \r\n            }\r\n            return await base.AuthenticateLocalAsync(username + \"XXXXXXX\", password + \"YYYYY\", message);\r\n        }    \r\n \r\n    }\r\n------------------------------------------------\r\n"},"comment":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/comments/106913497","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/1418#issuecomment-106913497","issue_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1418","id":106913497,"user":{"login":"moiseyo","id":5314730,"avatar_url":"https://avatars.githubusercontent.com/u/5314730?v=3","gravatar_id":"","url":"https://api.github.com/users/moiseyo","html_url":"https://github.com/moiseyo","followers_url":"https://api.github.com/users/moiseyo/followers","following_url":"https://api.github.com/users/moiseyo/following{/other_user}","gists_url":"https://api.github.com/users/moiseyo/gists{/gist_id}","starred_url":"https://api.github.com/users/moiseyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moiseyo/subscriptions","organizations_url":"https://api.github.com/users/moiseyo/orgs","repos_url":"https://api.github.com/users/moiseyo/repos","events_url":"https://api.github.com/users/moiseyo/events{/privacy}","received_events_url":"https://api.github.com/users/moiseyo/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T19:45:25Z","updated_at":"2015-05-29T19:45:25Z","body":"Fo You have a Book , I'll buy it.\n\n\nMoisey O\nSenior Application Developer\nmoiseyoys@gmail.com\n*[image: linkedinbutton] <https://www.linkedin.com/in/oysgeltm>*\nThe view changes only for the leading dog.\n\nOn Fri, May 29, 2015 at 12:15 PM, Brock Allen <notifications@github.com>\nwrote:\n\n> What's the error? Check the logs to find out more information.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/IdentityServer/IdentityServer3/issues/1418#issuecomment-106861374>\n> .\n>\n"}}