user =
UserInfo with properties:
UserID: 'someid'
DisplayName: <missing>
Groups: <missing>
Domain: 'SOME_DOMAIN'
MATLAB Web App Server で詳細なユーザー情報を有効にするには、userinfo.json ファイルを作成して、webapps_private フォルダーに配置します。このファイルは、ID プロバイダー (IdP) のプロパティを MATLAB プロパティにマップし、そのデータにアクセスできるアプリを定義します。
{
"version": "1.0.0",
"userInfo.doc": "Property values to be fetched during login from IdP",
"userInfo": {
"UserID": "upn",
"DisplayName": "displayName",
"Groups": "groups",
"LastName": "surname",
"Email": "mail"
},
"appAccess.doc": "Policy for allowing access to user properties within an app or group of apps",
"appAccess": {
"Health/BloodPressure": ["UserID", "Email"],
"Finance/Mortgage": ["UserID", "LastName"],
"Mystery": ["UserID", "Email", "WebAppsRole"]
}
}
appAccess オブジェクトのキーは、アプリのルート フォルダーに相対的な Web アプリの場所に対応します。アプリケーションがサブフォルダーに保存されている場合、マッピングにフォルダー パスを含める必要があります。
function startupFcn(app)
try
user = compiler.UserInfo();
catch me
% Handle errors if the server is not configured for authenticationreturnendif ~ismissing(user.UserID)
app.WelcomeLabel.Text = "Welcome, " + user.UserID;
endend