Http auth demo using AngularJS

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Http auth demo using AngularJS

pz_wang
Hi,

A demo app on how to do http auth using Ratpack and AngularJS, https://github.com/panzhangwang/ratpack-angular-auth  . Right now it is kind of shabby and some of codes are hard-coded.

For the demo,  try to use user/pass to log in, when you are posting protected content.

Thanks,
Panzhang Wang
Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
In reply to this post by pz_wang
Let me know if you have any thoughts on what could be improved or could be more convenient.
Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

pz_wang
Hi, Ratpack caught my eyes a couple of days ago and right now I am not good enough to find a smart solution. But, can we do something like the way Dropwizard does to support some authentications: basic http, cookie, OAuth, persona and etc.


Date: Sat, 1 Jun 2013 02:59:14 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

Let me know if you have any thoughts on what could be improved or could be more convenient.


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p15.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
You'll have to be more specific as I'm not that familiar with Dropwizard.

What do you want to do?

On 01/06/2013, at 11:25, "pz_wang [via Ratpack Forum]" <[hidden email]> wrote:

Hi, Ratpack caught my eyes a couple of days ago and right now I am not good enough to find a smart solution. But, can we do something like the way Dropwizard does to support some authentications: basic http, cookie, OAuth, persona and etc.


Date: Sat, 1 Jun 2013 02:59:14 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

Let me know if you have any thoughts on what could be improved or could be more convenient.


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p15.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML



If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p16.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

pz_wang
Any idea to add general 404 error page in this demo? I could not figure it out from online API docs.


Date: Sat, 1 Jun 2013 03:39:10 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

You'll have to be more specific as I'm not that familiar with Dropwizard.

What do you want to do?

Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
Just add a handler after the assets handler.

On 01/06/2013, at 13:46, "pz_wang [via Ratpack Forum]" <[hidden email]> wrote:

Any idea to add general 404 error page in this demo? I could not figure it out from online API docs.


Date: Sat, 1 Jun 2013 03:39:10 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

You'll have to be more specific as I'm not that familiar with Dropwizard.

What do you want to do?




If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p18.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
In reply to this post by pz_wang
What kind of 404 response do you want to have? Do you want just a status code? Or a HTML page?

On 01/06/2013, at 13:46, "pz_wang [via Ratpack Forum]" <[hidden email]> wrote:

Any idea to add general 404 error page in this demo? I could not figure it out from online API docs.


Date: Sat, 1 Jun 2013 03:39:10 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

You'll have to be more specific as I'm not that familiar with Dropwizard.

What do you want to do?




If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p18.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

pz_wang
I need Ratpack script pipeline to handle 404 request and support customized 404 page rendering. Any comments?


Date: Sat, 1 Jun 2013 08:32:17 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

What kind of 404 response do you want to have? Do you want just a status code? Or a HTML page?

Reply | Threaded
Open this post in threaded view
|

Re: Http auth demo using AngularJS

Luke Daley
Administrator
Instead of using clientError in the last handler, use

response.status(404)
get(TemplateRenderer).render …

Check the groovy console sample for how to use the template renderer.

We are working on docs.

On 01/06/2013, at 16:38, "pz_wang [via Ratpack Forum]" <[hidden email]> wrote:

I need Ratpack script pipeline to handle 404 request and support customized 404 page rendering. Any comments?


Date: Sat, 1 Jun 2013 08:32:17 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

What kind of 404 response do you want to have? Do you want just a status code? Or a HTML page?




If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack-framework.org/Http-auth-demo-using-AngularJS-tp11p21.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

pz_wang
Thanks for the clarification.

I just looked at MethodHandler.java. My understanding is that Ratpack will use 405 instead of 404. Is that correct?


Date: Sat, 1 Jun 2013 09:38:29 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

Instead of using clientError in the last handler, use

response.status(404)
get(TemplateRenderer).render …

Check the groovy console sample for how to use the template renderer.

We are working on docs.

Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

pz_wang
In reply to this post by Luke Daley
Just to explain more...

After login, user supposed to post content to a URL: /apps/protect. when modifying JavaScript to post content through Ajax to a fake one: /apps/foo, server will return 405 error.


FYI. If there is no error handler at the end of script, it will return 404 error, when just typing some non-existing URL into the browser and do a GET, like: http://localhost:5050/apps/foo/bar


From: [hidden email]
To: [hidden email]
Subject: RE: Http auth demo using AngularJS
Date: Mon, 3 Jun 2013 13:21:01 +0800

Thanks for the clarification.

I just looked at MethodHandler.java. My understanding is that Ratpack will use 405 instead of 404. Is that correct?


Date: Sat, 1 Jun 2013 09:38:29 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: Http auth demo using AngularJS

Instead of using clientError in the last handler, use

response.status(404)
get(TemplateRenderer).render …

Check the groovy console sample for how to use the template renderer.

We are working on docs.

Reply | Threaded
Open this post in threaded view
|

RE: Http auth demo using AngularJS

Luke Daley
Administrator
pz_wang wrote
After login, user supposed to post content to a URL: /apps/protect. when modifying JavaScript to post content through Ajax to a fake one: /apps/foo, server will return 405 error.

FYI. If there is no error handler at the end of script, it will return 404 error, when just typing some non-existing URL into the browser and do a GET, like: http://localhost:5050/apps/foo/bar
This was a bug in Ratpack. I've fixed it and sent you a pull request with some code updates.

To make sure you get the latest Ratpack snapshot, run `./gradlew run --refresh-dependencies`.