diff --git a/README.md b/README.md index e439c9a..f44c53c 100644 --- a/README.md +++ b/README.md @@ -123,10 +123,6 @@ docker run -p 8080:8080 easemob/easemob-im-live-server - 直播间服务需调用环信REST接口,该模块提供调用环信REST服务,包含token、user、chatroom API的调用,封装了调用所需的RequestBody、ResponseBody。 -#### [qiniu-service](./qiniu-service) - -- 获取七牛云直播推拉流地址。 - #### [agora-server](./agora-app-server) - 获取声网token。 @@ -145,6 +141,3 @@ docker run -p 8080:8080 easemob/easemob-im-live-server - 直播间支持点播功能 - 直播间支持Docker部署 - 直播间详情返回的成员列表过滤了owner - -### 1.0.2.Final -- 支持获取七牛云推拉流地址 diff --git a/agora-app-server/README.md b/agora-app-server/README.md index 63c9469..19b78de 100644 --- a/agora-app-server/README.md +++ b/agora-app-server/README.md @@ -1,3 +1,4 @@ # AgoraAppServer -AgoraAppServer用来获取声网Token -环信AppServer通过http接口获取Token + +## 介绍 +AgoraAppServer是用来获取声网Token的开源项目。 diff --git a/agora-app-server/pom.xml b/agora-app-server/pom.xml index e8b46a4..020a093 100644 --- a/agora-app-server/pom.xml +++ b/agora-app-server/pom.xml @@ -54,7 +54,10 @@ 2.6 compile - + + org.springframework.cloud + spring-cloud-starter-consul-discovery + diff --git a/agora-app-server/src/main/java/com/easemob/agora/AgoraServerApplication.java b/agora-app-server/src/main/java/com/easemob/agora/AgoraServerApplication.java index 2032a45..c683bae 100644 --- a/agora-app-server/src/main/java/com/easemob/agora/AgoraServerApplication.java +++ b/agora-app-server/src/main/java/com/easemob/agora/AgoraServerApplication.java @@ -2,6 +2,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * ClassName: SpringBootApplication @@ -9,6 +10,7 @@ * author: lijian * date: 2021-01-19 09:15 **/ +@EnableDiscoveryClient @SpringBootApplication public class AgoraServerApplication { diff --git a/agora-app-server/src/main/java/com/easemob/agora/config/SecurityConfig.java b/agora-app-server/src/main/java/com/easemob/agora/config/SecurityConfig.java index a7a7a72..e9da940 100644 --- a/agora-app-server/src/main/java/com/easemob/agora/config/SecurityConfig.java +++ b/agora-app-server/src/main/java/com/easemob/agora/config/SecurityConfig.java @@ -32,7 +32,7 @@ ) public class SecurityConfig extends WebSecurityConfigurerAdapter { - @Autowired + /*@Autowired private SecurityAuthenticationEntryPoint unauthorizedHandler; @Autowired @@ -49,17 +49,17 @@ public TokenAuthenticationProcessingFilter tokenFilter() { @Bean public UsernameAuthenticationProcessingFilter usernameFilter() { return new UsernameAuthenticationProcessingFilter(); - } + }*/ @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) { return builder.build(); } - @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { + /* @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(tokenAuthenticationProvider); auth.authenticationProvider(usernameProvider); - } + }*/ @Override protected void configure(HttpSecurity http) throws Exception { @@ -69,32 +69,33 @@ public RestTemplate restTemplate(RestTemplateBuilder builder) { .csrf() .disable() .exceptionHandling() - .authenticationEntryPoint(unauthorizedHandler) + //.authenticationEntryPoint(unauthorizedHandler) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() - .authorizeRequests() - .antMatchers("/", - "/management/**", - "/favicon.ico", - "/**/*.png", - "/**/*.gif", - "/**/*.svg", - "/**/*.jpg", - "/**/*.html", - "/**/*.css", - "/**/*.js") - .permitAll() - .antMatchers("/token/**", "/channel/**") - .hasAuthority("user") - .anyRequest() - .authenticated(); + .anonymous(); +// .authorizeRequests() +// .antMatchers("/", +// "/management/**", +// "/favicon.ico", +// "/**/*.png", +// "/**/*.gif", +// "/**/*.svg", +// "/**/*.jpg", +// "/**/*.html", +// "/**/*.css", +// "/**/*.js") +// .permitAll() +// .antMatchers("/token/**", "/channel/**") +// .hasAuthority("user") +// .anyRequest() +// .authenticated(); // 添加token auth filter // 也可以支持username password的方式只需要配置相应的filter和provider - http.addFilterBefore(tokenFilter(), UsernamePasswordAuthenticationFilter.class); - http.addFilterAfter(usernameFilter(), TokenAuthenticationProcessingFilter.class); + //http.addFilterBefore(tokenFilter(), UsernamePasswordAuthenticationFilter.class); + //http.addFilterAfter(usernameFilter(), TokenAuthenticationProcessingFilter.class); } } diff --git a/agora-app-server/src/main/java/com/easemob/agora/config/auth/token/TokenAuthenticationProvider.java b/agora-app-server/src/main/java/com/easemob/agora/config/auth/token/TokenAuthenticationProvider.java index 23a0b6d..3c50e3a 100644 --- a/agora-app-server/src/main/java/com/easemob/agora/config/auth/token/TokenAuthenticationProvider.java +++ b/agora-app-server/src/main/java/com/easemob/agora/config/auth/token/TokenAuthenticationProvider.java @@ -12,7 +12,7 @@ import java.util.Collections; @Slf4j -@Component +//@Component public class TokenAuthenticationProvider implements AuthenticationProvider { @Autowired diff --git a/agora-app-server/src/main/java/com/easemob/agora/config/auth/username/UsernameAuthenticationProvider.java b/agora-app-server/src/main/java/com/easemob/agora/config/auth/username/UsernameAuthenticationProvider.java index cfda3c3..d26f8d7 100644 --- a/agora-app-server/src/main/java/com/easemob/agora/config/auth/username/UsernameAuthenticationProvider.java +++ b/agora-app-server/src/main/java/com/easemob/agora/config/auth/username/UsernameAuthenticationProvider.java @@ -11,7 +11,7 @@ import java.util.Collections; @Slf4j -@Component +//@Component public class UsernameAuthenticationProvider implements AuthenticationProvider { private final RestManger restManger; diff --git a/agora-app-server/src/main/java/com/easemob/agora/config/security/SecurityAuthenticationEntryPoint.java b/agora-app-server/src/main/java/com/easemob/agora/config/security/SecurityAuthenticationEntryPoint.java index e26de9f..000c928 100644 --- a/agora-app-server/src/main/java/com/easemob/agora/config/security/SecurityAuthenticationEntryPoint.java +++ b/agora-app-server/src/main/java/com/easemob/agora/config/security/SecurityAuthenticationEntryPoint.java @@ -11,7 +11,7 @@ import java.io.IOException; @Slf4j -@Component +//@Component public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override diff --git a/pom.xml b/pom.xml index ff5fc2d..dcc85a4 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ mysql mysql-connector-java - 5.1.36 + 8.0.28 @@ -77,5 +77,16 @@ 1.2.51 - + + + + + org.springframework.cloud + spring-cloud-dependencies + Greenwich.SR6 + pom + import + + +