这是我的资源服务器的安全配置文件
@Configuration
@EnableWebSecurity
public class SecureSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.sessionManagement()
.sessionCreationPolicy(STATELESS)
.and()
.authorizeRequests()
.anyRequest()
.permitAll()
.antMatchers("api/**")
.authenticated()
.and()
.oauth2ResourceServer()
.jwt();
}
}
Run Code Online (Sandbox Code Playgroud)
这些是 Spring Boot 应用程序(资源服务器应用程序)的依赖项。
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-core</artifactId>
<version>5.5.3</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是配置 yml 文件中的 jwk-set-url,我的应用程序在启动时连接到该文件
spring:
security:
oauth2:
resourceserver:
jwt:
jwk-set-uri: http://localhost:8083/.well-known/openid-configuration/jwks
Run Code Online (Sandbox Code Playgroud)
现在通过邮递员,当我通过邮递员从身份验证服务器获取令牌并尝试向我的服务器请求时,我收到这种错误
Bearer error="invalid_token", error_description="An error occurred while attempting to decode the Jwt: Couldn't retrieve remote JWK set: org.springframework.web.client.HttpClientErrorException$NotFound: 404 null", …Run Code Online (Sandbox Code Playgroud) 将dev 分支合并到我的功能分支后,我想展示IntelliJ Idea中的差异,我看到一些文件已更改(可能尚未更改)与我真正更改的文件!
然后我双击该文件并在打开的窗口上方看到此消息:
“内容相同”。
所以这确实成为一个问题,因为我想恢复这个特定的更改,但它不允许我恢复。但尚未承诺或推动任何事情。git status命令也显示了该更改。我git reset --hard这样做了,它进入了之前的状态,就好像什么也没发生一样,再次git merge dev从我的功能分支进行,再次相同......
这是我的简单类,它在单独的线程中递增共享变量:
public class Main {
private volatile int count;
public static void main(String[] args) {
Main main = new Main();
main.doJob();
}
private void doJob() {
Runnable runnable1 = () -> {
for (int i = 0; i < 10000; i++) {
incrementCount();
}
};
Runnable runnable2 = () -> {
for (int i = 0; i < 10000; i++) {
incrementCount();
}
};
Thread t1 = new Thread(runnable1);
Thread t2 = new Thread(runnable2);
t1.start();
t2.start();
try {
t1.join();
t2.join(); …Run Code Online (Sandbox Code Playgroud)