These are chat archives for spring-guides/tut-spring-security-and-angular-js

8th
Oct 2015
Diyoda Sajjana
@dioode
Oct 08 2015 07:08
Hi @dsyer I am trying the last tutorial example and when I try to access the http://localhost:8080/ui/user on the browser, I pop up appears to enter the user name and the password. But when it is provided, the popup reappears without fulfilling the request.
Is this behavior desirable? what is actually causing this issue.
Dave Syer
@dsyer
Oct 08 2015 07:19
That's the browser responding to a 401. You need to get the request headers right (it works for me using the code in GitHub). See discussion in Section I.
Diyoda Sajjana
@dioode
Oct 08 2015 07:45
Thanks for the reply @dsyer . My goal is to access an end point using another client application. I tried to make a rest call using the header
Authorization: Basic dXNlcjpwYXNzd29yZA==
but it still prompts the popup. If I come to the http://localhost:8080/ui/user after authentication, it works fine as you have mentioned since the browser is intelligent. But without authentication, if I directly come to the http://localhost:8080/ui/user it prompts the popup. But when I put the user and pass word 3 times it gives the result which means it is not considering this as a single request.
Diyoda Sajjana
@dioode
Oct 08 2015 07:51
But I got the idea of browser treating the home page load as a single interaction in your tutorial.
What are the headers that I am missing, is it not just the Authentication Header that I need to call the rest method?
Diyoda Sajjana
@dioode
Oct 08 2015 08:21
Thanks @dsyer really appreciate the help :). I have been working on this for a long time. I will have a through read on your tutorial. Thanks for the excellent work on the tutorial
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 09:30
Wonderful examples I am trying to use this in our AngularJS + Spring Security webapps.... But could not run some examples like spring-session... Gets error related to Jedis... "caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class org.springframework.session.data.redis.
onfig.annotation.web.http.RedisHttpSessionConfiguration: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connect
on; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool"
Dave Syer
@dsyer
Oct 08 2015 09:31
You have redis running?
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 09:31
No I am not sure how to setup that... can I install that on Windows ?
I could not find information on how to do the setup - Redis
Dave Syer
@dsyer
Oct 08 2015 09:33
Try googling "redis server"?
You can use boot2docker I think
Which means you will need to set the redis hostname to the docker host (not localhost).
But that might be the best way
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 09:35
I m new to Dockers... is it quick n easy to setup on Linux... if so I can setup on Linux and point to that...
Dave Syer
@dsyer
Oct 08 2015 09:35
Linux is easier
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 09:44
Many thanks I have setup in linux now... can u please point how to point to this server.... ?
Dave Syer
@dsyer
Oct 08 2015 10:47
spring.redis.host=...
See Spring Boot user guide. Or use an IDE that supports property name completion.
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 10:57
I tried to add the below contents in application.yml still does n't work not sure if the format is right... ?
spring:
redis:
host: mydevhost
Dave Syer
@dsyer
Oct 08 2015 11:07
You need to indent it (put fences ``` around code snippets to preserve formatting)
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 11:32
Thanks .. we need a simple authentication using spring security in AngularJS.... can I follow your 'spring-security-angular/single ' example for a production environment ?
so that it would be simple without Redis... I don't understand what role Redis play in your other examples... can I ignore those... ?
Dave Syer
@dsyer
Oct 08 2015 12:41
Redis is there to share sessions between back end servers
If you only have one server you don't need it
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 12:47
We have exposed the DAO CRUD using REST Api and AngularJS client consumes the REST Api. Does it mean we should deploy the REST resource and the AngularJS web client in one server ?
Dave Syer
@dsyer
Oct 08 2015 12:47
Up to you. If they are not the same server you will have to deal with common origin policies.
Is this really anything to do with the sample code?
Jayakumar Jayaraman
@jjayaraman
Oct 08 2015 12:48
I am trying to adopt the concept from your sample code....