public dynamic Process(NancyModule nancyModule, AuthenticateCallbackData model)
 {
     switch((string)nancyModule.Context.Request.Query.providerkey)
     {
         case "google":
             var googleLinkedAccount = new GoogleLinkedAccount(nancyModule, model);
             return model.AuthenticatedClient.ToString() + googleLinkedAccount.Respond().ToString();
         case "facebook":
             return "Sorry, facebook is not yet supported. Check again later.";
         default:
             return "No valid authentication provider found!!!";
     }
 }
        public dynamic Process(NancyModule nancyModule, AuthenticateCallbackData model)
        {
            switch ((string)nancyModule.Context.Request.Query.providerkey)
            {
            case "google":
                var googleLinkedAccount = new GoogleLinkedAccount(nancyModule, model);
                return(model.AuthenticatedClient.ToString() + googleLinkedAccount.Respond().ToString());

            case "facebook":
                return("Sorry, facebook is not yet supported. Check again later.");

            default:
                return("No valid authentication provider found!!!");
            }
        }
Exemplo n.º 3
0
        public AccountModule()
            : base("/api/account")
        {
            Get["/"] = _ =>
                {
                    return "Hello, this is the root for the API auth.";
                };

            Post["/tokensignin"] = _ =>
                {
                    // TO-DO: Getting ID token(not OAuth access token) from app,
                    // validate the token against provider and check if user
                    // exists and then, register or login the user.
                    var requestBody = this.Request.Form;
                    requestBody = this.Request.Body;
                    var signinRequestBody = new LoginRequestModel()
                    {
                        auth_id = this.Request.Form["auth_id"],
                        auth_provider = this.Request.Form["auth_provider"],
                        id_token = this.Request.Form["id_token"],
                        server_auth_code = this.Request.Form["server_auth_code"]
                    };
                    var googleLinkedModel = new GoogleLinkedAccount(signinRequestBody);
                    try
                    {
                        return googleLinkedModel.RespondToIDToken();
                    }
                    catch (Exception ex)
                    {
                        return ("Oops, an error occured. Details: " + ex.Message);
                    }

                };

            Get["/refreshtokencallback"] = _ =>
                {
                    return this.Request.Body.AsString();
                };

            Post["/refreshtokencallback"] = _ =>
                {
                    return this.Request.Body.AsString();
                };
        }
Exemplo n.º 4
0
        public AccountModule() : base("/api/account")
        {
            Get["/"] = _ =>
            {
                return("Hello, this is the root for the API auth.");
            };

            Post["/tokensignin"] = _ =>
            {
                // TO-DO: Getting ID token(not OAuth access token) from app,
                // validate the token against provider and check if user
                // exists and then, register or login the user.
                var requestBody = this.Request.Form;
                requestBody = this.Request.Body;
                var signinRequestBody = new LoginRequestModel()
                {
                    auth_id          = this.Request.Form["auth_id"],
                    auth_provider    = this.Request.Form["auth_provider"],
                    id_token         = this.Request.Form["id_token"],
                    server_auth_code = this.Request.Form["server_auth_code"]
                };
                var googleLinkedModel = new GoogleLinkedAccount(signinRequestBody);
                try
                {
                    return(googleLinkedModel.RespondToIDToken());
                }
                catch (Exception ex)
                {
                    return("Oops, an error occured. Details: " + ex.Message);
                }
            };

            Get["/refreshtokencallback"] = _ =>
            {
                return(this.Request.Body.AsString());
            };

            Post["/refreshtokencallback"] = _ =>
            {
                return(this.Request.Body.AsString());
            };
        }