dns server

apt install dnsmasq

vi /etc/dnsmasq.conf

1
2
3
4
server=8.8.8.8
server=114.114.114.114
 
address=/keycloak.euhat.com/192.168.188.134

sudo systemctl restart dnsmasq

把Docker当沙盒用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo docker run -itd \
  --name srv1 \
  -v /mnt/hgfs/share:/home/work/share \
  -p 9083:9083 \
  fedora:latest \
  /bin/bash
 
sudo docker exec -it srv1 /bin/bash
 
sudo docker stop srv1
#sudo docker start srv1
sudo docker rm srv1
sudo docker rmi fedora:latest
sudo docker system df -v
sudo docker ps -a --filter volume=<volume_name>

在Keycloak里添加飞书IdP

先在Keycloak的管理员控制台的Identity Providers中添加OAuth v2 idp,Alias比如设为feishu。具体参数参考:
https://open.feishu.cn/document/sso/web-application-sso/login-overview

添加后,登陆中使用feishu第三方登陆,Keycloak后台报异常:No identifier provider for identity.
原因是标准的OAuth2流程在第三步取user_info,返回的json是在根结点有sub字段表示登陆者id,但飞书的user_info返回字段不标准,比如需要我们改代码取data子节点的email作为登陆者id。

具体在keycloak-26.3.0\services\src\main\java\org\keycloak\broker\oauth\OAuth2IdentityProvider.java
doGetFederatedIdentity函数返回identity之前,加入代码:

1
2
3
4
5
            if (userInfo.has("data")) {
                JsonNode dataNode = userInfo.get("data");
                id = dataNode.get("email") != null ? dataNode.get("email").asText() : null;
                identity.setId(id);
            }

Docker Memo

不写dockerfile,快速运行镜像:
docker run -it --name redhat85 redhat/ubi8:8.5

Docker容器中ADD的文件是旧的:
docker-compose stop some-docker-id
docker-compose rm -v some-docker-id
docker-compose build --no-cache some-docker-id

Jni FindClass Returns Null

One reason is the version of jvm.dll which contains JNI_CreateJavaVM is different from the version of the class file which is assigned to FindClass.

When FindClass returns null, we can check the reason like this:

1
2
3
if (env->ExceptionCheck()) {
    env->ExceptionDescribe();
}

refer to: https://blog.csdn.net/liu_12345_liu/article/details/131154935

Print signature of a Java function:

javap -s -private Sample2

refer to: https://blog.csdn.net/fuhanghang/article/details/122257507

Vue3 自定义组件传参

父组件

1
2
3
4
5
6
7
8
9
<template>
  <HelloWor v-model:aaa="foo" />
  {{foo}}
</template>
<script setup>
import HelloWor from './Hello.vue'
import{ref}from 'vue'
const foo=ref()
</script>

子组件

1
2
3
4
5
6
7
8
9
10
11
<template>
  <input v-model="yyy" />
</template>
<script setup>
import{useAttrs,computed}from 'vue'
const attrs = useAttrs()
const emit = defineEmits(['update:aaa'])//v-model父传子必须要用emit声明,否则父的v-model修饰符会不起作用。
const yyy=computed({
get() {return attrs.aaa},
set(newV) {emit('update:aaa',newV)}})
</script>

refer to:
https://segmentfault.com/a/1190000044885561