public abstract class AuthContext
extends java.lang.Object
コンストラクタと説明 |
---|
AuthContext() |
修飾子とタイプ | メソッドと説明 |
---|---|
abstract boolean |
checkPermission(Permission permission)
現在実行中のユーザが引数のpermission(権限)を保持しているかどうかを判定します。
|
static void |
doPrivileged(java.lang.Runnable function)
指定のfunctionを特権実行(セキュリティ制約がない状態で実行)します。
|
static <T> T |
doPrivileged(java.util.function.Supplier<T> function)
指定のfunctionを特権実行(セキュリティ制約がない状態で実行)します。
|
abstract java.lang.Object |
getAttribute(java.lang.String name)
現在のセキュリティコンテキストに紐づいている属性を取得します。
|
abstract AuthTokenInfoList |
getAuthTokenInfos()
現在実行中のユーザに紐付く認証トークンのリストを取得します。
|
abstract java.lang.Class<? extends Credential> |
getCredentialTypeForTrust()
現在のログインセッションを信頼された認証にするために必要なCredentialの型を取得します。
|
static AuthContext |
getCurrentContext()
現時点のセキュリティ情報(AuthContext)を取得します。
|
abstract java.lang.String |
getPolicyName()
現在実行中のユーザの認証ポリシー名を取得します。
|
abstract Tenant |
getTenant()
現在実行中のテナントを取得します。
|
abstract User |
getUser()
現在実行中のユーザを取得します。
|
abstract boolean |
isAuthenticated()
現在のセッションが認証済みユーザによるものか否かを取得します。
|
abstract boolean |
isCurrentSessionTrusted()
現在のログインセッションが信頼された認証に基づいたものか否かを取得します。
|
abstract boolean |
isPrivileged()
現在のAuthContextが特権実行されている状態かを取得します。
|
abstract void |
refresh()
現在のAuthContext(User情報、セキュリティ権限)を再読み込みします。
|
abstract boolean |
userInRole(java.lang.String role)
現在実行中のユーザが当該ロールかどうかを判定します。
|
public static AuthContext getCurrentContext()
public abstract Tenant getTenant()
public abstract User getUser()
public abstract AuthTokenInfoList getAuthTokenInfos()
public abstract java.lang.String getPolicyName()
public abstract java.lang.Object getAttribute(java.lang.String name)
name
- public abstract boolean isAuthenticated()
public abstract boolean isCurrentSessionTrusted()
public abstract java.lang.Class<? extends Credential> getCredentialTypeForTrust()
public abstract boolean userInRole(java.lang.String role)
role
- ロール名public abstract boolean checkPermission(Permission permission)
permission
- 判定したいPermissionのインスタンスpublic abstract void refresh()
public abstract boolean isPrivileged()
public static <T> T doPrivileged(java.util.function.Supplier<T> function)
//EntityManager経由の検索を権限によらず特権実行する。 EntityManager em = ... SearchResult<Entity> res = AuthContext.doPrivileged(() -> em.searchEntity(new Query("select oid from HogeEntity")));
function
- public static void doPrivileged(java.lang.Runnable function)
//EntityManager経由の更新を権限によらず特権実行する。 EntityManager em = ... Entity entity = ... AuthContext.doPrivileged(() -> { UpdateOption op = new UpdateOption(true); op.setUpdateProperties("name", "propA"); em.update(entity, op); });
function
-