K2 blackpearl 0807 and custom security providers

  • 24 February 2022
  • 0 replies
  • 55 views

Userlevel 2
Badge +9
 

K2 blackpearl 0807 and custom security providers

KB000331

PRODUCT
K2 blackpearl 0807
BASED ON
K2 blackpearl 0807

SEE ALSO How to register a Security Provider

LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Introduction

For security reasons the K2 Server in K2 blackpearl 0807 will only load custom assemblies that have been registered in the K2 Database. This means that at startup, if the K2 Server is required to load a custom assembly then the custom assembly must be registered. Otherwise, only the default or out of the box assemblies will load when the server starts up.

This requirement applies to the assembly that implements the secuirty interface, for example IHostableSecurityProvider and excludes the assembly(ies) that are referenced by the assembly implementing the interface.

To clarify this: If assembly A implements IHostableSecurityProvider, and assembly A references assembly B then only Assembly A must be registered in the K2 Database. Assembly A must be copied into the [Install Directory]K2 blackpearlHost ServerinSecuirtyProviders and assembly B, the referenced assembly(ies) must be copied to [Install Directory]K2 blackpearlHost Serverin.

 

 

How to register the assembly

The steps required to register the assembly are provided below:
 
  1. The assembly that contains your Security Provider, must be signed. Get the public key token for the assembly.
    To obtain the Public token key do the following
    • Open the Visual Studio command promt
    • Type: sn.exe -T [full path to strong named assembly]
  2. Run the following script against the Host Server database:
    INSERT INTO [HostServer].[dbo].[AssemblyRegistration]
       ([AssemblyID]
       ,[AssemblyName]
       ,[PublicKeyToken]
       ,[Enabled])
    VALUES
       (newid()
       ,'[AssemblyName]'
       ,'[PublicKeyToken]'
       ,1)

    Where [AssemblyName] is the name of the assembly example: SourceCode.Security.Providers.SampleProvider (excluding the ‘.dll’, i.e. not the strong name) Where [PublicKeyToken] is the public key token that you signed the assembly with, obtained in step 1.
     

  3. Make the following change to the [Install Dir]k2 blackpearlHost ServerBinK2HostServer.config file
    <appSettings>
    ...
    <add key="useassemblyregistration" value="true" />
    ...
    </appSettings>
  4. Restart the K2Server.

 


0 replies

Be the first to reply!

Reply