Spring Oauth2 resource server with jwt token store working without verification key -
i implemented oauth2 authorization server jwt token store. have configured use private/public verfification key. here tokenconverter implementation.
@bean public tokenstore tokenstore() { return new jwttokenstore(jwttokenenhancer()); } @bean protected jwtaccesstokenconverter jwttokenenhancer() { keystorekeyfactory keystorekeyfactory = new keystorekeyfactory(new classpathresource("jwt.jks"), "mysecretkey".tochararray()); jwtaccesstokenconverter converter = new jwtaccesstokenconverter(); converter.setkeypair(keystorekeyfactory.getkeypair("jwt")); return converter; }
in resource server have added
security: basic: enabled: false oauth2: resource: user-info-uri: http://localhost:8050/user jwt: key-value: -----begin public key----- miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeaky30ipcsc+uni2xix07gu0u+pnxjyyit9/qdzvrmyxg2j+w8i1gzfkwjeuv8imrxnfy2wocwe281ck689ji2wbpd3sfxnjeyuzjthk3tsspnuefwym7yz90iqt8tpocvbpmwrnu3tk09coh2cczjvjbawtwglkm2zelk0v8npa1itzlrnhqtgydiatmpnevbyhamu2bklredmknq4paax0hhkiu78buop7aaslicybqjxp+wo3ps8514bycfdrh5bnmt/0urvmsv9ew2u2shojbau98lviaoo98rshyue3iu9rzsw0bce4xuzkkuuhborzlayhzv1ihinu6pqo+bmqidaqab -----end public key-----
and works fine.
the problem it's still working if remove public key configuration, , can rest resource. expect won't able decode token without specifying matching public key.
how can configure authorization server token not decoded without correct public key?
Comments
Post a Comment