java - JHipster, Spring Social & Principal -


dears,

i have generated app jhipster. however, in order sure map social profiles local accounts, want users sign social accounts once connected only. social connection must optional (users' convenience).

in brief, want use jwt tokens sign social profiles , either jwt or oauth signin when activated.

technically, thought had enhance code of both socialuser , socialservice match profileinfo (from social authentication response) local user login info.

unfortunately, social service doesn't return authentication info (from spring security)and cannot retrieve principal.

any idea may help?

sample code:

// find user within social repository userid     if (stringutils.isblank(email) && !stringutils.isblank(usrid)) {         optional<socialuser> suser = sudao.findonebyusrid(usrid);         if (suser.ispresent()) {             // retrieve corresponding user             return optional.of(suser.get().getuser());         } else {             // create social user             optional<user> ousr = udao.findonebyusername(securityutils.getcurrentuserlogin());             if (ousr.ispresent()) {                 user u = ousr.get();                 socialuser su = new  socialuser(u.getexternalid(), usrid, providerid, u);                 sudao.save(su);                 log.debug("creating social user for: {}", u);             }          }     } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -