Skip to content

Instantly share code, notes, and snippets.

View robertoporfiro's full-sized avatar
🏠
Working from home

Roberto Porfiro robertoporfiro

🏠
Working from home
View GitHub Profile
@robertoporfiro
robertoporfiro / CORS Filter
Created February 29, 2024 18:00 — forked from wildoctopus/CORS Filter
How to fix the CORS issue on backend side , java Springboot App (Handling Simple CORS requests)
//Contents from https://spring.io/understanding/CORS
In the simplest scenario, cross-origin communications starts with a client making a GET, POST, or HEAD request against a resource on the server.
In this scenario, the content type of a POST request is limited to application/x-www-form-urlencoded, multipart/form-data, or text/plain. The request includes an Origin header that indicates the origin of the client code.
The server will consider the request's Origin and either allow or disallow the request. If the server allows the request, then it will respond with the requested resource and an Access-Control-Allow-Origin header in the response. This header will indicate to the client which client origins will be allowed to access the resource. Assuming that the Access-Control-Allow-Origin header matches the request's Origin, the browser will allow the request.
On the other hand, if Access-Control-Allow-Origin is missing in the response or if it doesn't match the request's Origin, the browser will disallow th
@robertoporfiro
robertoporfiro / CORS Filter
Created February 29, 2024 18:00 — forked from zachowdhury/CORS Filter
How to fix the CORS issue on backend side , java Springboot App (Handling Simple CORS requests)
//Contents from https://spring.io/understanding/CORS
In the simplest scenario, cross-origin communications starts with a client making a GET, POST, or HEAD request against a resource on the server.
In this scenario, the content type of a POST request is limited to application/x-www-form-urlencoded, multipart/form-data, or text/plain. The request includes an Origin header that indicates the origin of the client code.
The server will consider the request's Origin and either allow or disallow the request. If the server allows the request, then it will respond with the requested resource and an Access-Control-Allow-Origin header in the response. This header will indicate to the client which client origins will be allowed to access the resource. Assuming that the Access-Control-Allow-Origin header matches the request's Origin, the browser will allow the request.
On the other hand, if Access-Control-Allow-Origin is missing in the response or if it doesn't match the request's Origin, the browser will disallow th
@robertoporfiro
robertoporfiro / nginx-auth.yaml
Created February 22, 2024 19:45 — forked from carlosedp/nginx-auth.yaml
NGINX Keycloak Authentication
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx
@robertoporfiro
robertoporfiro / spring-and-jaeger.yaml
Created February 22, 2024 16:02 — forked from HasanKhatib/spring-and-jaeger.yaml
SpringBoot + Jaeger docker-compose file
version: '3.3'
services:
observability:
image: jaegertracing/all-in-one:1.38
ports:
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "4317:4317"
@robertoporfiro
robertoporfiro / cert-chain-generator.sh
Created December 18, 2023 21:51 — forked from PetrMc/cert-chain-generator.sh
cert chain generation script
#!/bin/bash
# the script started as a copy from getcert.sh located on docs.tetrate.com some variables are reporposed
APP="orders"
DNS="local"
# Creating openssl config file for the leaf cert
cat <<EOF | envsubst > ${APP}.cnf
[req]
default_bits = 2048
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "execute-api:/*/*/*"
},
{
@robertoporfiro
robertoporfiro / pom.xml
Created August 24, 2023 23:21 — forked from statico/pom.xml
minimal maven pom.xml to download JARs in to a lib/ directory
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>bar</artifactId>
<version>0.0.1-SNAPSHOT</version>
@robertoporfiro
robertoporfiro / README.md
Created June 2, 2022 14:51 — forked from m1keil/README.md
Configure Kibana to use SAML with Google Workspace (Google Apps, G Suite)

The following worked with Elastic Cloud, Elasticsearch & Kibana v7.6.0. It should be pretty close for other kinds of deployments. Before starting, make sure you have the right license level that allows SAML.

Create SAML App in Google Workspace:

  • Navigate to the SAML apps section of the admin console
  • Click the Add button and choose to "Add custom SAML app"
  • Write down the Entity ID and download the Idp metadata file
  • Choose application name, description and add logo
  • In the "Service Provider Details" screen add the following:
@robertoporfiro
robertoporfiro / Client_Side_RPC.py
Created February 26, 2022 11:47 — forked from shiyazt/Client_Side_RPC.py
This Section illustrates the Client Side and Server side RPC (Remote Procedure Call) in ThingsBoard IoT Platform. Client_Side_RPC.py : This program will illustrates the Client side, RPC Server_Side_RPC.py : This Program will illustrates the Server side RPC and Temperature_Controller_Server_Side_RPC.py : This program illustrates Server side RPC u…
# This Program illustrates the Client Side RPC on ThingsBoard IoT Platform
# Paste your ThingsBoard IoT Platform IP and Device access token
# Client_Side_RPC.py : This program will illustrates the Client side
import os
import time
import sys
import json
import random
import paho.mqtt.client as mqtt
@robertoporfiro
robertoporfiro / nginx-thingsboard
Created February 26, 2022 11:46 — forked from shiyazt/nginx-thingsboard
Thingsboard nginx reverse proxy with websocket and HTTPS support (Let's Encrypt)
server {
listen 80;
server_name EXTERNAL_THINGSBOARD_DOMAIN.com;
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
server {