LoginSignup
0
0

More than 3 years have passed since last update.

ADFS HRD画面に表示される「Active Directory」を別名に変えたい

Last updated at Posted at 2021-02-18

レルム選択画面の表示名を変更する。

image_thumb10.png

赤波線のとこを会社名とか別名に変えたい。
でもActiveDirectoryはプロパティ変更不可のため、Get-AdfsClaimsProviderTrustを使って表示名を変更しようとしてもエラーになってしまう。

解決方法

A. HRD画面が表示されるタイミングで読み込まれるonload.jsを修正して、「Active Directory」と表示されてるエレメントを無理やり書き換える。

以下やり方です。

①現在のWebテーマをコピーする。

デフォルトのWebテーマ(default)をいじると元に戻せなくなるので注意!
コピーしたテーマをいじって反映させます。

WindowsPowerShell
New-AdfsWebTheme -Name <新しいテーマ名> -SourceName <現在使用しているテーマ名>

現在カスタムテーマをを使用している場合はそちらをコピーしてください。

WindowsPowerShell
#現在使用しているテーマ名の取得
Get-AdfsWebConfig

②新しいテーマをエクスポートする。

WindowsPowerShell
Export-AdfsWebTheme -Name <新しいテーマ名> -DirectoryPath C:\Webthem

既存のADFSのテーマを取得できる


C:\Webthem
├───css
│       style.css
│       style.rtl.css
│
├───illustration
│       illustration.png
│
├───images
│   └───idp
│           idp.png
│           localsts.png
│           otherorganizations.png
│
└───script
        onload.js

③JavaScript修正

script\onload.jsを開いて最終行に下記を追加。

onload.js
 //Check if we are in the HRD page
if ( document.getElementById("hrdArea") ) {
    var strADCPName = "変更したい表示名" ;
    //Create an array of all claim provider trust section in the page
    var listAllSpanForIdp = document.getElementsByClassName("idpDescription float") ;
    var inc;
    for (inc = 0; inc < listAllSpanForIdp.length; inc++) {
        if ( listAllSpanForIdp[ inc ].innerHTML == "<span class=\"largeTextNoWrap indentNonCollapsible\">Active Directory</span>" ) {
            //Change the HTML content of the matching section to the value specified in the strADCPName variable
            listAllSpanForIdp[ inc ].innerHTML = "<span class=\"largeTextNoWrap indentNonCollapsible\">"+ strADCPName +"</span>" ;
        }
    }
}

④修正したJavaScriptをADFSに読み込ませる

WindowsPowerShell
Set-AdfsWebTheme -TargetName CorpWebTheme -AdditionalFileResource @{Uri="/adfs/portal/script/onload.js";path="C:\Webthem\script\onload.js"}

⑤カスタムしたテーマを設定する。

コピーしたWebテーマを有効にする。

WindowsPowerShell
Set-AdfsWebConfig -ActiveThemeName <新しいテーマ名>

元に戻したいときはSet-AdfsWebConfig -ActiveThemeName defaultでデフォルトのテーマ(もしくはコピー元のテーマ)を有効にしてください。

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0