스칼라 Play 프레임워크의 인증/권한 문서 참조자료이다. 



https://www.playframework.com/documentation/2.6.x/ScalaActionsComposition#Authentication


https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.mvc.Security$$AuthenticatedBuilder$


https://github.com/playframework/playframework/blob/2.6.x/framework/src/play/src/main/scala/play/api/mvc/Security.scala


http://fizzylogic.nl/2016/11/27/authorize-access-to-your-play-application-using-action-builders-and-action-functions/



Posted by '김용환'
,



터미널에서 curl이나 wget을 이용해 특수문자를 바로 사용하면 문제가 생길 수 있다. 이럴 때 다음과 같은 커캔드를 사용하면 uri escape 문자를 확인할 수 있다. (perl은 항상 리눅스에 깔려 있다..)


[~] echo -n '!' | perl -MURI::Escape -le 'print uri_escape <STDIN>'

%21


[~] echo -n ' ' | perl -MURI::Escape -le 'print uri_escape <STDIN>'

%20


[~] echo -n '%' | perl -MURI::Escape -le 'print uri_escape <STDIN>'

%25

Posted by '김용환'
,

[play] JWT token 예제

scala 2018. 2. 9. 12:09




https://www.playframework.com/documentation/2.6.x/SettingsSession



application.conf 설정


# jwt

play.http.session.maxAge = 60 minutes




소스


Ok("Welcome!").withSession(

  "connected" -> "user@gmail.com")





실제 jwt 토큰으로 오는 값(curl 명령어로 확인할 수 있음)


Set-Cookie: PLAY_SESSION=eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImNvbm5lY3RlZCI6InVzZXJAZ21haWwuY29tIn0sImV4cCI6MTUxODA4Mzk0OSwibmJmIjoxNTE4MDgwMzQ5LCJpYXQiOjE1MTgwODAzNDl9.ZqgXH3x6gEDwXZdFcZJ3i9lDSuO2JO8q3kZdzOUsKBU; Max-Age=3600; Expires=Thu, 08 Feb 2018 20:59:09 GMT; SameSite=Lax; Path=/; HTTPOnly






Posted by '김용환'
,