Skip to content

Instantly share code, notes, and snippets.

View lbroudoux's full-sized avatar

Laurent Broudoux lbroudoux

View GitHub Profile
{
"title": "Tweets Search",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
@lbroudoux
lbroudoux / KeycloakUmaProtocolConfigConverter.java
Created March 7, 2018 09:49
Custom Spring Boot converter for Keycloak AUthroization Services on Spring Boot
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig;
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
/**
* @author laurent
*/
@Component
@ConfigurationPropertiesBinding
@lbroudoux
lbroudoux / gist:a50aef1825fa12bca57ce2310d3e50d8
Created November 19, 2018 13:07
minishift iptables -L -n -v
[docker@knative ~]$ sudo su -
[root@knative ~]# iptables -L -n -v
Chain INPUT (policy ACCEPT 12729 packets, 3049K bytes)
pkts bytes target prot opt in out source destination
14114 854K KUBE-EXTERNAL-SERVICES all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate NEW /* kubernetes externally-visible service portals */
5292K 2513M KUBE-NODEPORT-NON-LOCAL all -- * * 0.0.0.0/0 0.0.0.0/0 /* Ensure that non-local NodePort traffic can flow */
5328K 2641M KUBE-FIREWALL all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
@lbroudoux
lbroudoux / gist:f8b372f6dc29f0b1f30f1a46931a4ab3
Created November 19, 2018 13:09
minishift iptables -L -n -v -t nat
[root@knative ~]# iptables -L -n -v -t nat
Chain PREROUTING (policy ACCEPT 59 packets, 3932 bytes)
pkts bytes target prot opt in out source destination
96468 7113K KUBE-SERVICES all -- * * 0.0.0.0/0 0.0.0.0/0 /* kubernetes service portals */
19155 1285K KUBE-PORTALS-CONTAINER all -- * * 0.0.0.0/0 0.0.0.0/0 /* handle ClusterIPs; NOTE: this must be before the NodePort rules */
917 58684 DOCKER all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
884 56572 KUBE-NODEPORT-CONTAINER all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL /* handle service NodePorts; NOTE: this must be the last rule in the chain */
Chain INPUT (policy ACCEPT 1 packets, 72 bytes)
pkts bytes target prot opt in out source destination
@lbroudoux
lbroudoux / main.ts
Last active March 13, 2020 12:45
secured-fruits-catalog-k8s-main.ts #keycloak
//platformBrowserDynamic().bootstrapModule(AppModule)
var keycloak = window["Keycloak"](location.origin + '/assets/keycloak-config.json');
keycloak.init({onLoad: 'login-required'}).success(function (authenticated) {
if (authenticated) {
window['keycloak'] = keycloak;
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
}
}).error(function () {
@lbroudoux
lbroudoux / auth.http-interceptors.ts
Last active March 13, 2020 12:44
secured-fruits-catalog-k8s-auth.http-interceptors.ts #keycloak
import { Injectable } from '@angular/core';
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthenticationService } from "./auth.service";
@Injectable()
export class AuthenticationHttpInterceptor implements HttpInterceptor {
constructor(protected authService: AuthenticationService) { }
@lbroudoux
lbroudoux / application.properties
Last active February 17, 2020 13:18
secured-fruits-catalog-k8s-application.properties #keycloak
keycloak.auth-server-url=${KEYCLOAK_URL:http://localhost:8180/auth}
keycloak.realm=fruits-catalog
keycloak.resource=fruits-catalog-app
keycloak.bearer-only=true
keycloak.ssl-required=external
keycloak.disable-trust-manager=true
keycloak.security-constraints[0].authRoles[0]=admin
keycloak.security-constraints[0].authRoles[1]=manager
keycloak.security-constraints[0].authRoles[2]=user
@lbroudoux
lbroudoux / PetStore sample.yaml
Created July 31, 2019 11:02
PetStore sample with examples for mocking
---
openapi: 3.0.2
info:
title: PetStore sample
version: 1.0.0
description: A sample API that uses a petstore as an example to demonstrate features
in the OpenAPI 3.0 specification
termsOfService: http://swagger.io/terms/
contact:
name: Swagger API Team
@lbroudoux
lbroudoux / API Pastry Copy.postman_collection.json
Created October 2, 2019 15:32
API Pastry Copy.postman_collection.json
{
"info": {
"_postman_id": "6d56a960-3eb3-429d-9a31-76602091a4eb",
"name": "API Pastry Copy",
"description": "version=1.2.0 - API definition of API Pastry sample app\n\nContact Support: \n{\n\nName : Laurent Broudoux\n\nEmail : laurent.broudoux@gmail.com\n\n}",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "pastry",
@lbroudoux
lbroudoux / API Pastry - 2.0.yaml
Created November 20, 2019 16:40
API Pastry - 2.0.yaml
---
openapi: 3.0.2
info:
title: API Pastry - 2.0
version: 2.0.0
description: API definition of API Pastry sample app
contact:
name: Laurent Broudoux
url: http://github.com/lbroudoux
email: laurent.broudoux@gmail.com