Keycloak を認可サーバーとして、SSO 出来ました!
FESS の system.properties
sso.type=oic
oic.auth.server.url=http://localhost:80xx/auth/realms/<レルム名>/protocol/openid-connect/auth
oic.client.id=<fess用のクライアント名>
oic.scope=openid email roles
oic.redirect.url=http://localhost:8080/sso/
oic.token.server.url=http://localhost:80xx/auth/realms/<レルム名>/protocol/openid-connect/token
oic.client.secret=<クライアントのクレデンシャル、シークレット>
oic.default.roles=xxxx
Keycloak の、クライアントに定義したロールが受け渡せるとベストですが、Access Token のロールって、標準じゃないので、
OpenIdConnectAuthenticator.java の parseJwtClaim をカスタマイズしなければならないのですね…
Keycloak のアクセストークン サンプル:
{
"exp": 1614314042,
"iat": 1614313742,
"auth_time": 1614313742,
"jti": "cec6ea93-3391-4ecc-b66f-81b38dafd636",
"iss": "http://localhost:80xx/auth/realms/xxxxx",
"aud": "account",
"sub": "xxxxxxx",
"typ": "Bearer",
"azp": "fess",
"nonce": "xxxxxxx",
"session_state": "xxxxxxxx",
"acr": "1",
"allowed-origins": [
"*"
],
"realm_access": {
"roles": [
"offline_access",
"uma_authorization"
]
},
"resource_access": {
"fess": {
"roles": [
"USER"
]
},
"account": {
"roles": [
"manage-account",
"manage-account-links",
"view-profile"
]
}
},
"scope": "openid email profile",
"email_verified": false,
"name": "名 氏",
"preferred_username": "my_name",
"locale": "ja",
"given_name": "名",
"family_name": "氏"
}
Keycloak は レルムとクライアントとユーザーに、ロールが設定できて、クライアント fess に USER ロールを追加したトークンです。
特定の認可サーバーの実装に依存しない形のまま使用するならば
今のところ、「ログインが必要 」、クローラーのパーミッション なし とするか、
クローラーのパーミッションに指定したロールを、 oic.default.roles に、固定で定義するのがよいでしょうか?