spring - how to define bean for JwtTokenStore and Configure -


i trying define logout user once user logout jwttoken remove memory. try configure authorizationserverconfiguration , @autowire tokenstore in authenticationrestcontroller it's gives me error

org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'authenticationrestcontroller': unsatisfied dependency expressed through field 'tokenstore'; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'authorizationserverconfiguration': unsatisfied dependency expressed through field 'jwtaccesstokenconverter'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'jwttokenenhancer' defined in class path resource [com/owo/security/config/authorizationserverconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.security.oauth2.provider.token.store.jwtaccesstokenconverter]: circular reference involving containing bean 'authorizationserverconfiguration' - consider declaring factory method static independence containing instance. factory method 'jwttokenenhancer' threw exception; nested exception java.lang.noclassdeffounderror: org/springframework/security/jwt/crypto/sign/macsigner 

please tell me how can configure jwttokenstore in configuration?

below code

the authenticationrestcontroller:

private final static string this_class = authenticationrestcontroller.class.getname();  @value("${jwt.header}") private string tokenheader;  @autowired private tokenstore tokenstore;   @autowired private jwttokenutil jwttokenutil;  @autowired private userdetailsservice userdetailsservice;  @autowired iuserservice userservice;  @autowired private userrepository userrepository;     @requestmapping(value = "/logout", method = requestmethod.get) @responsestatus(httpstatus.ok)   public void logout(httpservletrequest request) {     string authheader=request.getheader("authorization");     if(authheader!=null) {         string tokenvalue=authheader.replace("bearer", "").trim();         oauth2accesstoken accesstoken=tokenstore.readaccesstoken(tokenvalue);         tokenstore.removeaccesstoken(accesstoken);     }     } 

the authorizationserverconfiguration:

@autowired private authenticationmanager authenticationmanager;   @autowired private userdetailsservice userdetailsservice;   @autowired  jwtaccesstokenconverter jwtaccesstokenconverter;    @bean  protected tokenstore tokenstore() {      return new jwttokenstore(jwtaccesstokenconverter);  }  @bean protected jwtaccesstokenconverter jwttokenenhancer() {     jwtaccesstokenconverter converter=new jwtaccesstokenconverter();     converter.setsigningkey("");     converter.setverifierkey("");     return converter;        }    @override public void configure(authorizationserverendpointsconfigurer endpoints) throws exception {     // todo auto-generated method stub     endpoints.tokenstore(tokenstore())     .tokenenhancer(jwttokenenhancer())     .authenticationmanager(authenticationmanager)     .userdetailsservice(userdetailsservice);         } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -