Skip to content

Instantly share code, notes, and snippets.

View ikane's full-sized avatar

Ibrahima Kane ikane

  • Paris
View GitHub Profile
package com.eureka.zuul.security;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ikane
ikane / SecurityTokenConfig.java
Created April 30, 2019 21:33 — forked from OmarElgabry/SecurityTokenConfig.java
Gateway Security Configurations
package com.eureka.zuul.security;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@RunWith(Parameterized.class)
public class CalculatorTest {
@Parameters(name = "{index}: CalculatorTest({0})={1}, throws {2}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"1 + 1", 2, null},
{"1 + 1 + 1", 3, null},
{"1–1", 0, null},
{"1 * 1", 1, null},
{"1 / 1", 1, null},
@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {
@Autowired
ApplicationContext ac;
@Test
public void contextLoads() {
Calculator calculator = ac.getBean(Calculator.class);
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<!-- select non-aggregate reports -->
<report>report</report>
digraph architecture {
rankdir=LR;
// Storage - #303F9F (dark blue)
node[fillcolor="#303F9F" style="filled" fontcolor="white"];
database[label="DB"]; cache[label="Redis"];
// Client-side Apps - #FFEB3B (yellow)
node[fillcolor="#FFEB3B" style="filled" fontcolor="black"];
front_end[label="Front-end App"]; extension[label="Browser Extension"];
# Migrating to another remote repo
cd <local_repo>
git remote set-url origin <remote>
git push -u origin master
git push --all
git push --tags
#
# generate a keypair on the (Jenkins) machine you’re sending files *from*, then add the resulting public key (id_rsa.pub for example)
# into the .ssh/authorized_keys file of the user that’s receiving the files on your remote machines.
# in the publish over ssh config, you’ll enter the path to your private key on your jenkins host, not the remote hosts. if your Jenkins
# user doesn’t have a keypair, you can generate one using ‘ssh-keygen’ command and be sure to _not_ enter in a passphrase.
# when your job execs, SSH will use this path to your private key (for ex, /var/lib/jenkins/.ssh/id_rsa) when negotiating with the remote
# host and it will match it against the remote host’s .ssh/authorized_keys file entry that you made.
cat id_rsa.pub | (ssh administrator@vzylvmmsapp4 "cat >> .ssh/authorized_keys")
FROM openjdk:8-jdk-alpine
VOLUME /tmp
MAINTAINER Denis Rosa <denis.rosa@couchbase.com>
ARG JAR_FILE
ADD ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]