This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.port = 7070 | |
# zuul route mapping for the student-service | |
zuul.routes.website-name.url = http://localhost:8081/name | |
zuul.routes.students.path = /students/* | |
zuul.routes.students.url = http://localhost:8081/students | |
zuul.routes.students-courses.path = /courses/*/students | |
zuul.routes.students-courses.url = http://localhost:8081/courses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table if exists oauth_client_details; | |
create table oauth_client_details ( | |
client_id VARCHAR(255) PRIMARY KEY, | |
resource_ids VARCHAR(255), | |
client_secret VARCHAR(255), | |
scope VARCHAR(255), | |
authorized_grant_types VARCHAR(255), | |
web_server_redirect_uri VARCHAR(255), | |
authorities VARCHAR(255), | |
access_token_validity INTEGER, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; | |
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; | |
@Configuration | |
@EnableResourceServer | |
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true, jsr250Enabled = true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import javax.annotation.security.RolesAllowed; | |
@RestController | |
public class WelcomeController { | |
@GetMapping("/public") | |
public String welcomePublic() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.security.authentication.AuthenticationManager; | |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
import org.springframework.security.crypto.password.PasswordEncoder; | |
@EnableWebSecurity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
jdbc { | |
#jdbc connector should be stored in the logstash docker container | |
jdbc_driver_library => "/usr/share/logstash/mysql-driver/mysql-connector-java-5.1.47-bin.jar" | |
jdbc_driver_class => "com.mysql.jdbc.Driver" | |
jdbc_connection_string => "jdbc:mysql://xxx.162.xxx.101:3306/employee_db" | |
jdbc_user => "root" | |
jdbc_password => "root123" | |
#logstash will be run in every minute as scheduled below. | |
schedule => "* * * * *" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.elasticsearch.index.query.MultiMatchQueryBuilder; | |
import org.elasticsearch.index.query.QueryBuilder; | |
import org.elasticsearch.index.query.QueryBuilders; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | |
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | |
import org.springframework.data.elasticsearch.core.query.SearchQuery; | |
import org.springframework.web.bind.annotation.*; | |
import java.util.ArrayList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.elasticsearch.client.Client; | |
import org.elasticsearch.client.transport.TransportClient; | |
import org.elasticsearch.common.settings.Settings; | |
import org.elasticsearch.common.transport.TransportAddress; | |
import org.elasticsearch.transport.client.PreBuiltTransportClient; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; | |
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; |
NewerOlder