Storing Configuration Data in BizTalk Enterprise SSO

來源:互聯網
上載者:User

<sso>
<application name="upzoneSSO">
<description>The upzoneSSO application</description>
<contact>upzone@126.com</contact>
<appuserAccount>BTS2006R2\upzone</appuserAccount>
<appAdminAccount>BTS2006R2\administrator</appAdminAccount>
<field ordinal="0" label="Reserved" masked="no"/>
<field ordinal="1" label="User Id" masked="no" />
<field ordinal="2" label="Password" masked="yes" />
<flags groupApp="no" configStoreApp="yes" allowTickets="no" validateTickets="yes" allowLocalAccounts="yes" timeoutTickets="yes" adminAccountSame="no" enableApp="no" />
</application>
</sso>

Notice the 0 ordinal being reserved, this must be set as so, or an exception is thrown. 0號的是sso內部保留的,一定要加上,否則會出錯
<field ordinal="0" label="Reserved" masked="no"/>

同時注意,對於此類應用,需要註明configStoreApp="yes".否則無法繼續set操作

 

操作步驟:

1.設定Path變數:
   set path=%path%;C:\Program Files\Common Files\Enterprise Single Sign-On

2.create new app.
   ssomanage -createapps upzoneSSO\upzoneSSOApp.xml

3.enable app
   ssomanage -enableapp upzoneSSO

4.編譯BTSScnSSOApplicationConfig.exe工具,位於C:\Program Files\Microsoft BizTalk Server 2006\SDK\Scenarios\Common\SSOApplicationConfig

5.使用以下命令設定值
   BTSScnSSOApplicationConfig -set upzoneSSO ConfigProperties "User Id" sa Password upzone

6.測試get value
D:\Dev\SSODemo>BTSScnSSOApplicationConfig -get upzoneSSO ConfigProperties "Password"
Property <Password> = <upzone>

D:\Dev\SSODemo>BTSScnSSOApplicationConfig -get upzoneSSO ConfigProperties "User Id"
Property <User Id> = <sa>

7.C# Coding

public string identifierGUID="ConfigProperties";

public static string Read(string appName, string propName)

{

try

{

SSOConfigStore ssoStore = new SSOConfigStore();

ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();

((ISSOConfigStore) ssoStore).GetConfigInfo(appName, identifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag) appMgmtBag);

object propertyValue = null;

appMgmtBag.Read(propName, out propertyValue, 0);

return (string)propertyValue;

}

catch (Exception e)

{

throw;

}

}

public static void Write(string appName, string propName, string propValue)

{

try

{

SSOConfigStore ssoStore = new SSOConfigStore();

ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();

object tempProp = propValue;

appMgmtBag.Write(propName, ref tempProp);

((ISSOConfigStore)ssoStore).SetConfigInfo(appName, identifierGUID, appMgmtBag);

}

catch (Exception e)

{

throw;

}

}

Notice the use of the ConfigurationPropertyBag object which is just a class that inherits from IPropertyBag which signature looks like this:

public interface IPropertyBag

{

void Read(string propName, out object ptrVar, int errorLog);

void Write(string propName, ref object ptrVar);

}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.