Grails(17)Secure the REST API with Session Stick

Grails(17)SecuretheRESTAPIwithSessionStick

MycolleaguethinkofwayofauthorityofRESTAPIofourgrailsapplication.Thewayiswiseandeasy,theonlydisadvantageisthatthisstrategyissessionbased,ourstatelessRESTAPIshouldnotbindingtosessionsinthefuture.Butfornow,thisisanicesolution.

IusedPOSTMANplugininChrometocarrythefunctionstesting.

WhatwehaveingrailsforauthorityisspringsecuritywhichIusedforquitealongtime.

POSTURL:http://sillycat.console.com:8080/j_spring_security

Method:POST

FormData:j_username=username

j_password=password

FirsttimeIonlyputthatintheform-data,itdoesnotwork,thenIputtheminx-www-form-urlencoded,itworks.

Accordingtomycolleagues,curlalsoworks,butIdidgetachancetohaveatry.

curl--data"j_username=username&j_password=password"http://localhost:8088/j_spring_security_check

References:

https://bowerstudios.com/node/913

相关推荐