Friday, 26 July 2013

BizTalk BAM View How to attach related documents and restrict viewing to a select AD Group only.



This blog entry is all about BAM and in particularly how to attach related documents. But also as part of this blog entry I talk about BAM security in particularly how to restrict normal business users from viewing the related documents. Yet through IIS Authorisation we can allow a subset of users to view the related documents with the associated BAM activity.

Well attaching messages to a BAM activity is quite easy.

Here is the code.

First you will need to do
// Add document reference
bamDocument = msgRequest.Body;
bamDocumentName = "Inbound Request";
bamDocumentLink = System.String.Format(
                    "/BAM/BAMManagementService/BamManagementService.asmx/GetReferences?viewName={0}&activityName={1}&activityInstanceId={2}&referenceType={3}",
                    bamViewName,
                    bamActivityName,
                    bamActivityID,
                    bamDocumentName);
Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.AddReference(bamActivityName, bamActivityID, bamDocumentName, "Message Body",  System.DateTime.UtcNow.ToString(), bamDocument.DocumentElement.OuterXml);
Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.AddReference(bamActivityName, bamActivityID, "DocumentUrl", bamDocumentName,  bamDocumentLink, "");

Enabling HTTP GET on the Portal (BamManagementService.asmx web.config)

    <webServices>
        <protocols>
            <add name="HttpGet"/>
        </protocols>
    </webServices>
Now lets talk about security. As you probably already know all BAM Users can view the related documents via the BAM web portal. We now want to restrict these users from viewing the message as it may contain sensitive content. Hence we only want to allow a subset of privileged users the authorization to view these messages.

An effective easy solution is to use the ASP.NET authorisation components in web.config. As the “view message” action is the only action to issue GET verbs to the BAMManagementService.asmx as described above we can create an additional authorisation rule to only allow a subset (AD Group) to view these related documents/messages.

Lets review the web.config

<
configuration>
  <system.web>
    <authorization>
      <allow roles="Everyone" verbs="POST" />
      <allow roles="MICROANGELO\BAM MESSAGE VIEWERS" verbs="GET" />
      <deny users="*" />
    </authorization>       
  </system.web>
</configuration>

What I have done above is allow an ad-group MICROANGELO\BAM MESSAGE VIEWERS access to the message to view. All other users will not be allow to view the message.

There it is enjoy.

1 comment:

  1. SELAMAT TAHUN BARU 2014..
    Informasi yang sangat BERMANFAAT..
    Terima kasih..
    Semoga SUKSES & Salam KENAL dari :
    ==============================

    Paket Usaha Ayam Tulang Lunak “GEROBAKAN”
    ~
    ..Bukan SULAP bukan SIHIR
    Asap di GEROBAK, jadi UANG di KANTONG anda..
    ~
    Paket Usaha Ayam Tulang Lunak “GEROBAKAN” merupakan
    paket usaha kuliner yang mudah dijalankan,
    murah & mempunyai tingkat pengembalian modal yang sangat singkat.
    Hanya dengan Rp. 7.500.000,- Anda sudah dapat menjalankan
    BISNIS KULINER yang terbaik saat ini.
    ~
    Anda akan mendapatkan :
    -. Gerobak
    -. Peralatan masak bakar
    -. Peralatan masak goreng
    -. Kompor, tabung gas & regulatornya
    -. Brosur
    -. Spanduk
    -. Poster
    -. Produk Awal Ayam Tulang Lunak
    -. Kaos
    -. Training (Pelatihan) PELAYANAN (khusus mitra dalam Jabodetabek)
    ~
    Materi inti Training Pelayanan :
    -. Tata cara persiapan pembukaan outlet.
    -. Tata cara membakar & menggoreng ayam tulang lunak
    -. Tata cara menyajikan ayam tulang lunak
    -. Tata cara menyimpan ayam tulang lunak
    ~
    Silakan kunjungi web kami:
    ~
    www.tulanglunakgerobakan.com
    ~
    atau :
    Telpon & HP : 081318374450 (Telkom)
    08561070103 (Indosat)
    081806396669 (XL)
    021-94946600 (esia)
    021-70264774 (Flexi)
    Kantor: 021-4759274
    PIN BB : 28C97C54
    email : bumi.amrita@ymail.com
    ~
    & dapatkan kemudahan & keterangan lebih lanjut.
    Menu-menu andalan kami adalah :
    1. Ayam Bakar Tulang Lunak
    2. Ayam Goreng Tulang Lunak
    3. Pepes Ayam Tulang Lunak
    4. PepesCeker Tulang Lunak
    5. Bebek Bakar & Goreng
    ~
    Paket Usaha kami berikut menu andalannya telah diliput oleh :
    - Trans TV – Prog Jelang Siang – 28 November 2011 Pk 12.30 WIB
    - ANTV – Program Topik Pagi – 18 Juni 2012 Pk 04.45 WIB -> klik di sini
    dgn URL : http://www.youtube.com/watch?v=WrC1PvqExXc
    ~
    Program Usaha Ayam Tulang Lunak Gerobakan :
    1. Program Dalam Kota
    2. Program Luar Kota ( Program Master Mitra Mandiri)
    Terdiri :
    -. Paket Usaha Standar
    -. Mesin Presto
    -. Training Produksi
    Training Produksi bisa dilakukan di Jakarta atau di tempat mitra.
    Info lebih lanjut bisa dilihat di :
    http://www.tulanglunakgerobakan.com/mfm.html
    ~
    Ingin mencicipi sebelum bermitra ? Silakan order Paket Tester kami yg berisi :
    4 potong ayam tulang lunak (bisa dibakar & digoreng).
    2 pepes ayam tulang lunak
    2 pepes ceker ayam tulang lunak
    2 bebek presto (bisa dibakar & digoreng)
    1 bungkus SAMBAL khas gerobakan
    ~
    Untuk wilayah Jabodetak, kita antar ke tempat calon mitra
    & calon mitra bisa langsung berdiskusi dengan ACCOUNT OFFICER (AO) kami..
    ~
    Tunggu apa lagi, langsung silakan order…
    ~
    SUKSES sudah ada di depan mata kita, AYO BER-WIRAUSAHA !
    ~
    ~

    ReplyDelete