here is my code looks like:
public class MyController {
@Value("${resource.clientId}") // this value is retreiving from vault
private String clientId;
@PreAuthorize("isClient(#clientId)") //isClient a custom security method
public String Mymethod(Authentication authentication){
}
}
If I use the clientId as a arg of Mymethod, then it's working fine. But at the same time I am facing an issue like 'could not find the placeholder resource.clientId' due to vault APPROLE token expiry.
So decided to change the method arg to class level variable like above. But this @PreAuthorize [@PreAuthorize("isClient(#clientId)")] logic is not picking the clientid. Could anyone please share a suitable way to sort out this issue? Which expression do I need to use here to solve this?