I want to implement a simple remember me for logged in users, so they will stay logged in after closing the browser. So I was thinking creating a cookie that holds a unique key generated by UUID.randomUUID, and on the server side I map it to a username.
Is that secure enough? What are the risks? Should I take precautions to prevent hackers from trying random keys?
I was thinking about using a framework for authentication like spring security or apache shiro, but I couldn't find any benefit that they give me (I don't need complex access control, just user registration/login). Am I missing something crucial in terms of security?
update
I guess my question is actually: do frameworks like spring and shiro do something substantially more sophisticated for remember me functionality that produce security that I probably can't match?