Skip to content

Instantly share code, notes, and snippets.

View jamesdube's full-sized avatar
🛰️
To the moon

James Dube jamesdube

🛰️
To the moon
View GitHub Profile
@jamesdube
jamesdube / regex.txt
Last active February 5, 2024 14:29
Zimbabwe National ID Regex
# 00000000X00
/([0-9]{8,9}[a-z,A-Z][0-9]{2})/g
# 00-000000-X-00 dashes are optional
/([0-9]{2}-?[0-9]{6,7}-?[a-z,A-Z]-?[0-9]{2})/g
# 00-000000 X00 dash is required, space before letter is optional
/([0-9]{2}-[0-9]{6,7}\s?[a-z,A-Z][0-9]{2})/g
@jamesdube
jamesdube / README.md
Created March 18, 2022 16:44 — forked from int128/README.md
Example of Envoy TCP Proxy
package main
import (
"fmt"
"time"
"github.com/tsenart/vegeta/lib"
)
func testRate(rate int, sla time.Duration) bool {
@jamesdube
jamesdube / ansible-group-ips.yml
Created December 14, 2021 08:00
Extract all ip's from an ansible group
- hosts: all
name: get group ips in one line
gather_facts: false
vars:
all_servers_ip: "{{groups['all'] | map('extract',hostvars,['ansible_ssh_host']) | join(',') }}"
tasks:
- debug:
msg: "{{all_servers_ip}}"
@jamesdube
jamesdube / Build_seed_iso
Created November 12, 2021 20:57 — forked from asvignesh/Build_seed_iso
Samples to create a cloud-init configuration ISO.
$ genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
@jamesdube
jamesdube / gitlab_to_jira.py
Created June 12, 2021 22:09 — forked from mvisonneau/gitlab_to_jira.py
GitLab to Jira issue sync
#!/usr/bin/env python
import gitlab
from jira import JIRA
import urllib3
## Disable urllib3 ssl checks warnings
urllib3.disable_warnings( urllib3.exceptions.InsecureRequestWarning )
## GitLab config
stages:
- build
- push
- cleanup
build:
stage: build
variables:
REGISTRY_SERVER: foo.bar
IMAGE_NAME: vrutkovs-public/openshift-ansible-testing
@Component
public class LogFilter extends OncePerRequestFilter {
private static Logger LOG = LoggerFactory.getLogger(LogFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
LOG.info(request.getRequestURI()); // log the request path.
}
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:7013","description":"Generated server url"}],"paths":{"/api/v0/balances/msisdn/{msisdn}":{"get":{"tags":["balance-enquiry-controller"],"operationId":"enquire","parameters":[{"name":"msisdn","in":"path","required":true,"schema":{"type":"string"}},{"name":"productCode","in":"query","required":false,"schema":{"type":"string"}},{"name":"unitType","in":"query","required":true,"schema":{"type":"string"}},{"name":"accountCode","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseListEnquiryAccountBalance"}}}}}}}},"components":{"schemas":{"ApiResponseListEnquiryAccountBalance":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EnquiryAccountBalance"}},"success":{"type":"boolean"},"httpStatusCode":{"type":"integer","format":"int32"},"message":{"type":"string"},

This gist describes the configuration required for Spring reactive WebClient to make a call to an OAuth2 protected resource through OAuth2.0 Client Credentials Grant Type Flow.

Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.