Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile
@strongant
strongant / FeignConfiguration.java
Created September 2, 2022 17:33 — forked from mehmetcemyucel/FeignConfiguration.java
keycloak-feign-resttemplate
package com.cem.oauth2.configuration.feign;
import com.cem.oauth2.configuration.AuthProperties;
import feign.RequestInterceptor;
import org.keycloak.OAuth2Constants;
import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails;

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.

@strongant
strongant / gist:160d7a5a226cb1e0be5c9ec1cb212402
Created November 23, 2022 10:58 — forked from programaker/gist:5867408
Sending post request with params and fetching response content
public static String post(String urlString, String params, int timeout) throws Exception {
String response = null;
HttpURLConnection conn = null;
DataOutputStream dos = null;
InputStream is = null;
try {
URL url = new URL(urlString);
conn = (HttpURLConnection)url.openConnection();
conn.setDoInput(true);
@strongant
strongant / csv.sh
Created May 10, 2023 14:09 — forked from knyar/csv.sh
Nginx-lua-prometheus benchmark #3
#!/bin/bash
set -e -u -o pipefail
commits="1e13e22c 0.20200420 avoid-get_keys"
modes="parallel serial none"
output=results.csv
echo -n 'num_metrics' > $output
for mode in $modes; do
for commit in $commits; do
@strongant
strongant / CloneLearningTest.java
Created June 12, 2023 14:55 — forked from rherrmann/CloneLearningTest.java
'Learning Tests' that uses the JGit API to clone existing repositories: http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
package com.codeaffine.jgit.example;
import static java.util.Collections.singleton;
import static org.eclipse.jgit.api.ListBranchCommand.ListMode.ALL;
import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.List;

The view ClusterRole doesn’t actually have permissions for the Cluster level objects like Nodes and Persistent Volume Claims. So we’ll have to create a new RBAC config.

First, we’ll create a new dashboard-viewonly ClusterRole:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dashboard-viewonly