# Remove java 7
sudo yum remove -y java
# Install basic packages
sudo yum install -y git
# Download and install java 8
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
tar -xzvf jdk-8u131-linux-x64.tar.gz
/** | |
* Utility class to handle checked exceptions in lambdas. | |
* <p> | |
* From <a href="http://stackoverflow.com/questions/27644361/how-can-i-throw-checked-exceptions-from-inside-java-8-streams">How can I throw CHECKED exceptions from inside Java 8 streams?</a>. | |
* This class helps to handle checked exceptions with lambdas. Example, with Class.forName method, which throws checked exceptions: | |
* </p> | |
* <pre> | |
* Stream.of("java.lang.Object", "java.lang.Integer", "java.lang.String") | |
* .map(rethrowFunction(Class::forName)) | |
* .collect(Collectors.toList()); |
## Obtain Token and Invoke Service |
- 在http://start.spring.io/ 选择要测试的SpringBoot版本,这里选择“1.5.4.RELEASE”。
- 选择需要添加的模块依赖:选择spring-boot-starter-actuator和spring-boot-starter-test
- 点击生成项目按钮
- 解压项目压缩包
- 导入IDEA
- 在src/java 目录下新建具体的测试Controller,如创建HelloWorldController.java 测试Controller:
package com.example.springbootjunittest.controller;
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
- import project into idea command
$ curl -L "https://gist.githubusercontent.com/chrisdarroch/7018927/raw/9a6d663fd7a52aa76a943fe8a9bc6091ad06b18d/idea" -o /usr/local/bin/idea
$ chmod +x /usr/local/bin/idea
- unzip and open project command
$ curl -L "https://gist.githubusercontent.com/sgyyz/adfa4f05af3d81cf0e17e19cf7044c85/raw/b6b9e871d5a4f5435a09d00b0a52e3db0b90699a/uao.sh" -o /usr/local/bin/uao.sh
$ chmod +x /usr/local/bin/uao.sh
$ ln -sf /usr/local/bin/uao.sh /usr/local/bin/uao
#!/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 |
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.
This is a short and simple example on how to build a proper Keycloak cluster, using JDBC_PING
as discovery protocol and an NGINX server as reverse proxy.
As this is for legacy Keycloak version (Wildfly based, up until version 17), you can find an example for more current and uptodate versions at this gist here: https://gist.github.com/dasniko/3a57913047af3ca1b6b0a83b294dc1a1
Please see also my video about Keycloak Clustering: http://www.youtube.com/watch?v=P96VQkBBNxU