-
Notifications
You must be signed in to change notification settings - Fork 245
config property "security.resource.jwt.key-uri" caused UnknownHostException #227
Comments
Is |
sorry about taking a long time to reply it.
@RestController
@RequestMapping("/user")
public class UserController {
@GetMapping("/getCurrentUser")
public Object getCurrentUser(Authentication authentication, HttpServletRequest request) {
return authentication;
}
}
@RestController
@Slf4j
public class LoginController {
private final OAuth2RestTemplate oAuth2RestTemplate;
@Autowired
public LoginController(OAuth2RestTemplate oAuth2RestTemplate) {
this.oAuth2RestTemplate = oAuth2RestTemplate;
}
@GetMapping(value = "/user/get")
public Object getCurrentUser(){
Object user = this.oAuth2RestTemplate.getForEntity("http://data-auth-server/user/getCurrentUser",Object.class);
log.info("current login user's info:{}",JSON.toJSONString(user));
return ResponseEntity.ok().body(new HashMap<>());
}
} oauth2Template config: @Bean
@LoadBalanced
public OAuth2RestTemplate oAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context){
return new OAuth2RestTemplate(resource,context);
} the log has been printed as :
as the result shows , this is full configurations in application.yml for the oauth2 client: oauth2:
server:
uri: http://data-auth-server
token-uri: /oauth/token
auth-uri: /oauth/authorize
key-uri: /oauth/token_key
security:
oauth2:
client:
client-id: admin
client-secret: admin123456
user-authorization-uri: ${oauth2.server.uri}${oauth2.server.token-uri}
access-token-uri: ${oauth2.server.uri}${oauth2.server.auth-uri}
resource:
jwt:
key-uri: http://localhost:9000/oauth/token_key
|
Describe the bug
application ran failed with the message:
Sample
version describe:
by the way, if i use the following configuration for client application,it runs well:
is there any way to solve this exception?
The text was updated successfully, but these errors were encountered: