Hello
One of my client requires WMS video streaming with user/password
chellenge over his MS-SQL DB.
As far i read standard WMS plugins it's not possible to create this
funcionality with standard plugins, so i'am trying to develope my own
authentication plugin. And here starts problems.
Plugin code
[Guid("D3217092-3EC0-4d0a-9856-91E73E19BD07")]
public class AuthenticationPlugin : IWMSBasicPlugin,
IWMSAuthenticationPlugin, IWMSAuthenticationContext
{
#region IWMSBasicPlugin Members
public void DisablePlugin()
{
}
public void EnablePlugin(ref int plFlags, ref int
plHeartbeatPeriod)
{
}
public object GetCustomAdminInterface()
{
return null;
}
public void InitializePlugin(IWMSContext pServerContext,
WMSNamedValues pNamedValues, IWMSClassObject pClassFactory)
{
}
public void OnHeartbeat()
{
}
public void ShutdownPlugin()
{
}
#endregion
#region IWMSAuthenticationPlugin Members
public IWMSAuthenticationContext CreateAuthenticationContext()
{
return (IWMSAuthenticationContext)this;
}
public int GetFlags()
{
return Convert.ToInt32(
WMS_AUTHENTICATION_FLAGS.WMS_AUTHENTICATION_TEXT_CHALLENGE |
WMS_AUTHENTICATION_FLAGS.WMS_AUTHENTICATION_CLIENT_SHOWS_UI |
WMS_AUTHENTICATION_FLAGS.WMS_AUTHENTICATION_CHALLENGE_FIRST);
}
public string GetPackageName()
{
return "TiVi.WMSAuthentication";
}
public string GetProtocolName()
{
return "Custom";
}
#endregion
#region IWMSAuthenticationContext Members
public void Authenticate(object ResponseBlob, IWMSContext
pUserCtx, IWMSContext pPresentationCtx, IWMSCommandContext
pCommandContext, IWMSAuthenticationCallback pCallback, object Context)
{
pCallback.OnAuthenticateComplete(WMS_AUTHENTICATION_RESULT.WMS_AUTHENTICATION_SUCCESS,
null, Context);
}
public IWMSAuthenticationPlugin GetAuthenticationPlugin()
{
return (IWMSAuthenticationPlugin)this;
}
public string GetImpersonationAccountName()
{
return "";
}
public int GetImpersonationToken()
{
return 0;
}
public string GetLogicalUserID()
{
return "";
}
#endregion
}
COM register / unregister code:
public class Com
{
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
{
try
{
RegistryKey regHKLM = Registry.LocalMachine;
regHKLM =
regHKLM.CreateSubKey("SOFTWARE\\Microsoft\\Windows
Media\\Server\\RegisteredPlugins\\Authentication\\{D3217092-3EC0-4d0a-9856-91E73E19BD07}");
regHKLM.SetValue(null, "TiVi WMS Authentication
plugin");
RegistryKey regHKCR = Registry.ClassesRoot;
regHKCR =
regHKCR.CreateSubKey("CLSID\\{D3217092-3EC0-4d0a-9856-91E73E19BD07}\\Properties");
regHKCR.SetValue("Name", "TiVi WMS Authentication
plugin");
regHKCR.SetValue("Author", "Comtica");
regHKCR.SetValue("Copyright", "Copyright © Comtica
2007");
regHKCR.SetValue("Description", "TiVi WMS
authentication plugin");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Cannot Register",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
[ComUnregisterFunctionAttribute]
public static void UnRegisterFunction(Type t)
{
try
{
RegistryKey regHKLM = Registry.LocalMachine;
regHKLM.DeleteSubKey("SOFTWARE\\Microsoft\\Windows
Media\\Server\\RegisteredPlugins\\Authentication\\{D3217092-3EC0-4d0a-9856-91E73E19BD07}");
RegistryKey regHKCR = Registry.ClassesRoot;
regHKCR.DeleteSubKeyTree("CLSID\\{D3217092-3EC0-4d0a-9856-91E73E19BD07}");
regHKCR.DeleteSubKeyTree("TiVi.WMSAuthentication.AuthenticationPlugin");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Cannot delete a subkey.",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
Problems which i notice so far:
- can't register (regasm.exe TiVi.WMSAuthentication.dll) when library
is placed in c:\windows\system32\windows media\server; keep getting
error "RegAsm : error RA0000 : Unable to
dll' or one of its dependencies."
So i register library in other folder (program files) and after i
copied files to windows media\server and manually install in GAC
- next problem i noticed that Com class is called but none of register
keys isnt writed to registers; so i prepared reg files to write them
manually:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
Media\Server\RegisteredPlugins\Authentication\{D3217092-3EC0-4d0a-9856-91E73E19BD07}]
@="TiVi WMS Authentication plugin"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{D3217092-3EC0-4d0a-9856-91E73E19BD07}]
[HKEY_CLASSES_ROOT\CLSID\{D3217092-3EC0-4d0a-9856-91E73E19BD07}\Properties]
"Name"="TiVi WMS Authentication plugin"
"Author"="Comtica"
"Copyright"="Copyright © Comtica 2007"
"Description"="TiVi WMS authentication plugin"
After all that tricks i see plugin in authentication plugins in WMS but
i can't enable it, all time getting error "Error description: The
plug-in has reportered an error. See event viewer ... bla bla. Error
code: 0xc00d157d"
and in event viewer i got "Server failed with the following
information: Error code = 0x80131040, Error text = ''TiVi WMS
Authentication plugin''."
For testing i'am using windows 2003 enterprise with latest updates.
.NET library is comvisible and signed.
Any one had similar problem or can tell me what i'am doing wrong, can
send me some .NET wms plugin working template, because now i'am out of
any ideas.
best regards
Kuba Florczyk

Signature
KubaF
http://forums.techarena.in
javatopia - 19 Sep 2007 17:48 GMT
Hello,
Your code:
public string GetProtocolName()
{
return "Custom";
}
Should be either:
public string GetProtocolName()
{
return "Basic";
}
or
public string GetProtocolName()
{
return "Digest";
}
The WMS client only understands authentication protocols that are common to
the internet. If you do Basic, then you will get the username and password in
plaintext. If you do the Digest authentication scheme, then you will need to
do a considerable amount of additional programming to make it work. With
Digest authentication, the client does not provide a plaintext password, so
you will need to have a way to get that plaintext password on the server
side. If not, then you can not do Digest authentication.
-- Jake

Signature
Jacob W Anderson
---
http://www.beyond-ordinary.com
http://www.extremeplannerlive.com
---
If you think it''''s expensive to hire a professional to do the job, wait
until you hire an amateur.
> Hello
>
[quoted text clipped - 205 lines]
> best regards
> Kuba Florczyk
KubaF - 19 Sep 2007 21:29 GMT
Good point, but still i got problem with enabling plugin. Anyway
inplement DRM
--
Kuba
http://forums.techarena.i
Basti - 22 Oct 2007 21:43 GMT
you need to set the "[assembly: ComVisible(true)]" in the AssemblyInfo.cs.
Then you can register and call the plugin!
But there is something missing, because after enabling you cannot watch any
stream.
Richard - 29 Oct 2007 08:42 GMT
Hi, my friend. Have you solved your problem?
> and in event viewer i got "Server failed with the following
> information: Error code = 0x80131040, Error text = ''TiVi WMS
> Authentication plugin''."
from the error code "0x80131040",it is likely that the assembly probing
redirects your assembly to a different one. For example, you have an
assembly called A.dll references another strong named assembly B.dll, but
when deployment, you misplace a non strong named version of B.dll. During
assembly probing, it will complain that "The located assembly's manifest
definition does not match the assembly reference". If it happens to be a COM
client, HRESULT:0x80131040 will throw.
Additionally, I am facing the same situation as you did. What I want is the
client authentication ticket (here it is username and passwordd because it
is an asp.net web app using Forms authentication mode) forwards to media
server where the plugin can extract the ticket and authenticates against
MS-SQL DB. But I don't grab any clue to how to extract this ticket info in
my plugin? Any suggestions to provide?
Thanks and Regards.
"KubaF" <KubaF.2wjhzd@DoNotSpam.com> дÈëÏûÏ¢ÐÂÎÅ:KubaF.2wjhzd@DoNotSpam.com...
> > Hello
>
[quoted text clipped - 205 lines]
> best regards
> Kuba Florczyk
Basti - 29 Oct 2007 18:41 GMT
Hey Richard,
I haven't understood what you are writing. But I thing you are wrong.
Just set "[assembly: ComVisible(true)]" in the AssemblyInfo.cs and you can
compile and register with asmreg for instance.
Concerning you second problem I opened a support call at Microsoft to solve
this problem. When I recieve a running code example I will post it in this
thread.
Basti
> Hi, my friend. Have you solved your problem?
> > and in event viewer i got "Server failed with the following
[quoted text clipped - 227 lines]
> > best regards
> > Kuba Florczyk
Richard - 30 Oct 2007 03:16 GMT
Hello Basti.
There will be lots of pre-condition which might cause Managed Class
registered fail. What I said is just one of the possible cause. If you want
your managed type exposed to and created by COM client, you do need to have
it visible to COM. But occasionally, only making it visible to COM by
setting "[assembly:ComVisible(true)]" is not enough.
> Concerning you second problem I opened a support call at Microsoft to
> solve
> this problem. When I recieve a running code example I will post it in this
> thread.
I am looking forward to it! Thanks again.
"Basti" <Basti@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:88CDE41A-AF0D-45B9-BAD6-757E206BCC4A@microsoft.com...
> Hey Richard,
>
[quoted text clipped - 243 lines]
>> > best regards
>> > Kuba Florczyk