| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
22dbff4a4e | refactor to webflux | 4 years ago |
| @ -1 +1 @@ | |||
| [{"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/reportWebVitals.js":"1","/Users/dima/Projects/jce/auth-flow/demo-client-app/src/App.js":"2","/Users/dima/Projects/jce/auth-flow/demo-client-app/src/index.js":"3"},{"size":362,"mtime":1611244349228,"results":"4","hashOfConfig":"5"},{"size":1216,"mtime":1611250955596,"results":"6","hashOfConfig":"5"},{"size":1404,"mtime":1611250251472,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ewyx7q",{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/reportWebVitals.js",[],"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/App.js",[],"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/index.js",[]] | |||
| [{"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/reportWebVitals.js":"1","/Users/dima/Projects/jce/auth-flow/demo-client-app/src/App.js":"2","/Users/dima/Projects/jce/auth-flow/demo-client-app/src/index.js":"3"},{"size":362,"mtime":1611244349228,"results":"4","hashOfConfig":"5"},{"size":1212,"mtime":1611308679793,"results":"6","hashOfConfig":"5"},{"size":1404,"mtime":1611250251472,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ewyx7q",{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/reportWebVitals.js",[],"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/App.js",[],"/Users/dima/Projects/jce/auth-flow/demo-client-app/src/index.js",[]] | |||
| @ -0,0 +1,2 @@ | |||
| # This file is generated by the 'io.freefair.lombok' Gradle plugin | |||
| config.stopBubbling = true | |||
| @ -1,25 +1,29 @@ | |||
| package ru.digitalbanana.demoresourceserver.config; | |||
| import static org.springframework.security.config.Customizer.withDefaults; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.http.HttpMethod; | |||
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |||
| import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |||
| import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; | |||
| import org.springframework.security.config.web.server.ServerHttpSecurity; | |||
| import org.springframework.security.web.server.SecurityWebFilterChain; | |||
| @Configuration | |||
| public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||
| @EnableWebFluxSecurity | |||
| public class WebSecurityConfig { | |||
| @Bean | |||
| public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { | |||
| http | |||
| .authorizeExchange() | |||
| .pathMatchers(HttpMethod.OPTIONS).permitAll() | |||
| .anyExchange().authenticated() | |||
| .and() | |||
| .httpBasic().disable() | |||
| .oauth2ResourceServer() | |||
| .jwt(withDefaults()); | |||
| @Override | |||
| protected void configure(HttpSecurity http) throws Exception { | |||
| http.cors() | |||
| .and() | |||
| .authorizeRequests() | |||
| .antMatchers(HttpMethod.GET, "/userinfo", "/user/**") | |||
| .authenticated() | |||
| // .hasAuthority("SCOPE_web-api") | |||
| .anyRequest() | |||
| .authenticated() | |||
| .and() | |||
| .oauth2ResourceServer() | |||
| .jwt(); | |||
| } | |||
| return http.build(); | |||
| } | |||
| } | |||
| @ -1,39 +1,25 @@ | |||
| package ru.digitalbanana.demoresourceserver.persistence.model; | |||
| import javax.persistence.Column; | |||
| import javax.persistence.Entity; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| @Entity | |||
| @Table(name = "user_entity") | |||
| import org.springframework.data.annotation.Id; | |||
| import org.springframework.data.relational.core.mapping.Column; | |||
| import org.springframework.data.relational.core.mapping.Table; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Table("user_entity") | |||
| public class UserEntity { | |||
| @Id | |||
| @Column(name = "id") | |||
| @Column("id") | |||
| private String id; | |||
| @Column(name = "email") | |||
| public String email; | |||
| public String getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| this.id = id; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| public void setEmail(String email) { | |||
| this.email = email; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return "Foo [id=" + id + ", email=" + email + "]"; | |||
| } | |||
| @Column("email") | |||
| private String email; | |||
| } | |||
| @ -1,11 +1,12 @@ | |||
| package ru.digitalbanana.demoresourceserver.persistence.repository; | |||
| import java.util.List; | |||
| import org.springframework.data.repository.CrudRepository; | |||
| import org.springframework.data.repository.reactive.ReactiveCrudRepository; | |||
| import org.springframework.stereotype.Repository; | |||
| import reactor.core.publisher.Flux; | |||
| import ru.digitalbanana.demoresourceserver.persistence.model.UserEntity; | |||
| public interface IUserEntityRepository extends CrudRepository<UserEntity, String> { | |||
| List<UserEntity> findByEmailContainingIgnoreCase(String email); | |||
| @Repository | |||
| public interface IUserEntityRepository extends ReactiveCrudRepository<UserEntity, String> { | |||
| Flux<UserEntity> findByEmailContainingIgnoreCase(String email); | |||
| } | |||