How to send credentials to VirtualService

Apr 1, 2011 at 4:59 AM

Hi!

My last problem about Token was fixed I figured out.

My problem now is, how can I send to the Virtual WCF service my user credentials to verify with the [Authorization(roles)] attribute?

I mean, I'm a Silverlight application calling a VirtualService, so, where can I send my credentials from Silverlight to WCF so I can use your AuthorizationAttribute??

Thanks a lot for the support and your great work.

Best regards...

 

Gutemberg Ribeiro


Coordinator
Apr 1, 2011 at 1:55 PM

Since the Authentication model for Silveright/WCF and WCF in general is a complex model and can be implemented in several different ways with different providers, the HSS Virtual Service infrastructure does not try and recreate the wheel, and simply relies on the HttpContext.User to determine authentication/authorization so all scenarios should be supported.

What this means to you, is that you need to implement some type of authentication mechanism for your application in general. There are two pre-built AuthenticationServices that are available (ClientServices and DomainServices aka RIA Services), they both have a pre-built AuthenticationService that provides an authentication mechanism which in turn sets the HttpContext User for the Silverlight authenticated user.

I personally have my own AuthentcationService specific to supporting Silverlight and don't use ClientServices or DomainServices. It is a part of a new Silverlight Platform I'm building called Solarium OS(tm). Solarium will not be distributed freely on CodePlex though. If you're interested I am opening a beta in a few weeks, just send an email and I will get you on the list.

Apr 1, 2011 at 2:14 PM

Hi Hyspdrt!

Thanks for all the answers and clarifications.

I do have interest on check the Solarium OS. Tell me more about it. What features, how do you plan to charge users, etc…

While we don’t have this, I’ll start checking about AuthenticationService for Silverlight.

Thanks a lot, a waiting to hear from you soon.

Best regards…

Gutemberg

From: hyspdrt [email removed]
Sent: sexta-feira, 1 de abril de 2011 10:55
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Since the Authentication model for Silveright/WCF and WCF in general is a complex model and can be implemented in several different ways with different providers, the HSS Virtual Service infrastructure does not try and recreate the wheel, and simply relies on the HttpContext.User to determine authentication/authorization so all scenarios should be supported.

What this means to you, is that you need to implement some type of authentication mechanism for your application in general. There are two pre-built AuthenticationServices that are available (ClientServices and DomainServices aka RIA Services), they both have a pre-built AuthenticationService that provides an authentication mechanism which in turn sets the HttpContext User for the Silverlight authenticated user.

I personally have my own AuthentcationService specific to supporting Silverlight and don't use ClientServices or DomainServices. It is a part of a new Silverlight Platform I'm building called Solarium OS(tm). Solarium will not be distributed freely on CodePlex though. If you're interested I am opening a beta in a few weeks, just send an email and I will get you on the list.

Coordinator
Apr 1, 2011 at 2:44 PM

Solarium is large in the sense that it provides several sub-systems and nuances to support MVVM etc. but high level it's provide a generic Silverlight Platform in which you application can take advantage of all the base features of Solarium allowing you to focus on building you application.

Some high level features/benefits:

1. It is a complete platform for running Silverlight Application - you install Solarium and it runs as a web application - think Content Management System (CMS), but it's an Application Management System or how I like to think of it "a Web (SL) Operation System"
2. Supports In Browser and Out of Browser (but not offline - requires a network connection)
3. A complete component model - which includes a PropertyGrid simialr to the VS Style PropertyGrid. The component model is extensiable to support other derived models (e.g., a Page in Solarium is a derived component that support Views)
4. Complete authentcation/authorization model similar to the Windows OS (Users and UserGroups) and UserGroups can be nested to form Inheritiance chaining - including concept of users being associated with a Company
5. Complete page navigation model that leverages the authorization model, and support nested masterpages for complete navigational hierarchy and menuing
6. Includes base templates for Pages, MasterPages and ViewModels (full support for MVVM and is super easy to implement and support designtime and Blend)
7. Extensive Component and Control Library and includes a nice base Style Resource (appearance) for all SL Controls plus addition controls
8. Task Engine and Task Monitoring (Sync and Async)
9. A robust and extensiable configuration model for the Application and all Component settings with support for Company and User overrides
10. Everything is stored in the database (SQL Server) - great for Disaster Recovery and Web Farms or Clusters
11. Includes a complete policy infrastructure and management including support for Company overrides
12. Leverages and includes the HSS Interlink Upload and Download Dialog (http://interlink.codeplex.com)
13. Relies on the HSS Core Framework for a complete enterprise deployment model and scenarios
14. Leverages the HSS Database (an embedded Silverlight Client Side Database which will go into beta when Solarium goes beta) for caching of specific data and Xap Packages for a speedy user experience

Could go on, but I think you get the idea. The best part is your development process doesn't change. You build your Views (Pages) and ViewModels as normal from the VS IDE (or Blend) and then you simply install (register the xap package) with Solarium to make them available. Think iPhone + AppStore but for Silverlight. You then configure users access (page authorization) as necessary and your app is deployed and online.

At this point, I have limited documentation as I've been focused on development, but am working on that and will have more for the beta.

 

Apr 1, 2011 at 2:54 PM

Seems awesome J

If you want any help on it let me know.

Best regards…

Gutemberg

From: hyspdrt [email removed]
Sent: sexta-feira, 1 de abril de 2011 11:45
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Solarium is large in the sense that it provides several sub-systems and nuances to support MVVM etc. but high level it's provide a generic Silverlight Platform in which you application can take advantage of all the base features of Solarium allowing you to focus on building you application.

Some high level features/benefits:

1. It is a complete platform for running Silverlight Application - you install Solarium and it runs as a web application - think Content Management System (CMS), but it's an Application Management System or how I like to think of it "a Web (SL) Operation System"
2. Supports In Browser and Out of Browser (but not offline - requires a network connection)
3. A complete component model - which includes a PropertyGrid simialr to the VS Style PropertyGrid. The component model is extensiable to support other derived models (e.g., a Page in Solarium is a derived component that support Views)
4. Complete authentcation/authorization model similar to the Windows OS (Users and UserGroups) and UserGroups can be nested to form Inheritiance chaining - including concept of users being associated with a Company
5. Complete page navigation model that leverages the authorization model, and support nested masterpages for complete navigational hierarchy and menuing
6. Includes base templates for Pages, MasterPages and ViewModels (full support for MVVM and is super easy to implement and support designtime and Blend)
7. Extensive Component and Control Library and includes a nice base Style Resource (appearance) for all SL Controls plus addition controls
8. Task Engine and Task Monitoring (Sync and Async)
9. A robust and extensiable configuration model for the Application and all Component settings with support for Company and User overrides
10. Everything is stored in the database (SQL Server) - great for Disaster Recovery and Web Farms or Clusters
11. Includes a complete policy infrastructure and management including support for Company overrides
12. Leverages and includes the HSS Interlink Upload and Download Dialog (http://interlink.codeplex.com)
13. Relies on the HSS Core Framework for a complete enterprise deployment model and scenarios
14. Leverages the HSS Database (an embedded Silverlight Client Side Database which will go into beta when Solarium goes beta) for caching of specific data and Xap Packages for a speedy user experience

Could go on, but I think you get the idea. The best part is your development process doesn't change. You build your Views (Pages) and ViewModels as normal from the VS IDE (or Blend) and then you simply install (register the xap package) with Solarium to make them available. Think iPhone + AppStore but for Silverlight. You then configure users access (page authorization) as necessary and your app is deployed and online.

At this point, I have limited documentation as I've been focused on development, but am working on that and will have more for the beta.

Apr 1, 2011 at 3:05 PM

Regarding the Authentication and Authorization on SL, I just saw over the internet using RIA services…

From: hyspdrt [email removed]
Sent: sexta-feira, 1 de abril de 2011 10:55
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Since the Authentication model for Silveright/WCF and WCF in general is a complex model and can be implemented in several different ways with different providers, the HSS Virtual Service infrastructure does not try and recreate the wheel, and simply relies on the HttpContext.User to determine authentication/authorization so all scenarios should be supported.

What this means to you, is that you need to implement some type of authentication mechanism for your application in general. There are two pre-built AuthenticationServices that are available (ClientServices and DomainServices aka RIA Services), they both have a pre-built AuthenticationService that provides an authentication mechanism which in turn sets the HttpContext User for the Silverlight authenticated user.

I personally have my own AuthentcationService specific to supporting Silverlight and don't use ClientServices or DomainServices. It is a part of a new Silverlight Platform I'm building called Solarium OS(tm). Solarium will not be distributed freely on CodePlex though. If you're interested I am opening a beta in a few weeks, just send an email and I will get you on the list.

Apr 1, 2011 at 3:06 PM

Regarding the Authentication and Authorization on SL, I just saw over the internet using RIA services…

From: hyspdrt [email removed]
Sent: sexta-feira, 1 de abril de 2011 10:55
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Since the Authentication model for Silveright/WCF and WCF in general is a complex model and can be implemented in several different ways with different providers, the HSS Virtual Service infrastructure does not try and recreate the wheel, and simply relies on the HttpContext.User to determine authentication/authorization so all scenarios should be supported.

What this means to you, is that you need to implement some type of authentication mechanism for your application in general. There are two pre-built AuthenticationServices that are available (ClientServices and DomainServices aka RIA Services), they both have a pre-built AuthenticationService that provides an authentication mechanism which in turn sets the HttpContext User for the Silverlight authenticated user.

I personally have my own AuthentcationService specific to supporting Silverlight and don't use ClientServices or DomainServices. It is a part of a new Silverlight Platform I'm building called Solarium OS(tm). Solarium will not be distributed freely on CodePlex though. If you're interested I am opening a beta in a few weeks, just send an email and I will get you on the list.

Apr 3, 2011 at 5:10 AM

Just more one question mate.

To make the VirtualService work, I have to add a reference in VS2010 Web project to the assembly where the service is hosted. So, I want to remove this reference, and just ask the host to search in a defined directory(for sample the \bin of the website) for the assemblies and search for the services there.

Is there any way to do it on your code? I just don’t found where the services are loaded on your code.

Best regards…

Gutemberg

From: hyspdrt [email removed]
Sent: sexta-feira, 1 de abril de 2011 11:45
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Solarium is large in the sense that it provides several sub-systems and nuances to support MVVM etc. but high level it's provide a generic Silverlight Platform in which you application can take advantage of all the base features of Solarium allowing you to focus on building you application.

Some high level features/benefits:

1. It is a complete platform for running Silverlight Application - you install Solarium and it runs as a web application - think Content Management System (CMS), but it's an Application Management System or how I like to think of it "a Web (SL) Operation System"
2. Supports In Browser and Out of Browser (but not offline - requires a network connection)
3. A complete component model - which includes a PropertyGrid simialr to the VS Style PropertyGrid. The component model is extensiable to support other derived models (e.g., a Page in Solarium is a derived component that support Views)
4. Complete authentcation/authorization model similar to the Windows OS (Users and UserGroups) and UserGroups can be nested to form Inheritiance chaining - including concept of users being associated with a Company
5. Complete page navigation model that leverages the authorization model, and support nested masterpages for complete navigational hierarchy and menuing
6. Includes base templates for Pages, MasterPages and ViewModels (full support for MVVM and is super easy to implement and support designtime and Blend)
7. Extensive Component and Control Library and includes a nice base Style Resource (appearance) for all SL Controls plus addition controls
8. Task Engine and Task Monitoring (Sync and Async)
9. A robust and extensiable configuration model for the Application and all Component settings with support for Company and User overrides
10. Everything is stored in the database (SQL Server) - great for Disaster Recovery and Web Farms or Clusters
11. Includes a complete policy infrastructure and management including support for Company overrides
12. Leverages and includes the HSS Interlink Upload and Download Dialog (http://interlink.codeplex.com)
13. Relies on the HSS Core Framework for a complete enterprise deployment model and scenarios
14. Leverages the HSS Database (an embedded Silverlight Client Side Database which will go into beta when Solarium goes beta) for caching of specific data and Xap Packages for a speedy user experience

Could go on, but I think you get the idea. The best part is your development process doesn't change. You build your Views (Pages) and ViewModels as normal from the VS IDE (or Blend) and then you simply install (register the xap package) with Solarium to make them available. Think iPhone + AppStore but for Silverlight. You then configure users access (page authorization) as necessary and your app is deployed and online.

At this point, I have limited documentation as I've been focused on development, but am working on that and will have more for the beta.

Coordinator
Apr 3, 2011 at 5:15 AM

You shouldn't have to add a reference to anything except for in the main web project, you will have to add a reference to the HSS.ServiceModel.dll. That is required for the registration. But for your actual Service (which I'm assuming is in a separate DLL) does not need to be referenced, you should be able to compile and drop into the bin folder.

Apr 3, 2011 at 5:17 AM

Yeah, I’m referencing the service DLL just to VS drop it on Bin.

What I’m asking is, if is there a way to make HSS search for the services in another folder.

Thanks

From: hyspdrt [email removed]
Sent: domingo, 3 de abril de 2011 02:15
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

You shouldn't have to add a reference to anything except for in the main web project, you will have to add a reference to the HSS.ServiceModel.dll. That is required for the registration. But for your actual Service (which I'm assuming is in a separate DLL) does not need to be referenced, you should be able to compile and drop into the bin folder.

Coordinator
Apr 3, 2011 at 5:20 AM

Nope, that is controlled by ASP.NET. Sorry.

Apr 3, 2011 at 5:22 AM

Ok thanks!

From: hyspdrt [email removed]
Sent: domingo, 3 de abril de 2011 02:21
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

Nope, that is controlled by ASP.NET. Sorry.

Coordinator
Apr 3, 2011 at 5:25 AM

This may be what you're looking for, http://msdn.microsoft.com/en-us/library/823z9h8w.aspx

I have not tested this or confirmed it works, but seems like this should satisfy your desire to store the Virtual Services in a different folder other than the Bin folder.

Coordinator
Apr 3, 2011 at 5:33 AM

Let me know if this works, and if not I'll see if there is something I can make happen.

Apr 3, 2011 at 6:32 AM
No working. Still same error telling that assembly of service wasnt found.

Sent from my Windows Phone 7

From: hyspdrt
Sent: Sunday, April 03, 2011 2:33 AM
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]



> From: hyspdrt
>
> Let me know if this works, and if not I'll see if there is something I can make happen.
>
>
Coordinator
Apr 3, 2011 at 7:22 PM

OK, did some testing, and the type resolution will work, see below...

1. During the Service initialization (client side), you must include the name of the assmebly, not just the type. Must be = NamSpace.Type,AssemblyName
2. For folders other than the bin folder, you must specify a probing folder in the web config

So below here is how I got it to work...

Global.asax VirtualServiceProvider Registration

HSS.ServiceModel.VirtualServiceProvider.Initialize("test", false);
HSS.ServiceModel.VirtualServiceProvider.Register("vservices");

VirtualChannel Initialization

Modified initialization process in the SL App, to include the assembly name  ",TestVirtualService" which is required by the .NET Runtime for any non-referenced assemblies.

VirtualChannel<IVService1>.Initialize("vservices", "TestVirtualService.VService1,TestVirtualService", "test");

Web Config Changes

<runtime>
	<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
		<probing privatePath="vservices"/>
	</assemblyBinding>
</runtime>

Folder Changes

Added a folder name vservices and dropped in the un-referenced TestVirtualService.dll

Hit F5 and everything worked perfectly.

 

Apr 3, 2011 at 7:33 PM

Ok good! Thanks for the help.

I just don’t got the point at the SL client code. If we are just sending VirtualChannel<IVService1>.Initialize("vservices", "TestVirtualService.VService1,TestVirtualService", "test");

How can the VirtualChannel find the endpoint of the service if it is not hosted on the same host/server ?

Thanks a lot for support.

[]s

Best regards

From: hyspdrt [email removed]
Sent: domingo, 3 de abril de 2011 16:22
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]

From: hyspdrt

OK, did some testing, and the type resolution will work, see below...

1. During the Service initialization (client side), you must include the name of the assmebly, not just the type. Must be = NamSpace.Type,AssemblyName
2. For folders other than the bin folder, you must specify a probing folder in the web config

So below here is how I got it to work...

Global.asax VirtualServiceProvider Registration

HSS.ServiceModel.VirtualServiceProvider.Initialize("test", false);
HSS.ServiceModel.VirtualServiceProvider.Register("vservices");

VirtualChannel Initialization

Modified initialization process in the SL App, to include the assembly name ",TestVirtualService" which is required by the .NET Runtime for any non-referenced assemblies.

VirtualChannel<IVService1>.Initialize("vservices", "TestVirtualService.VService1,TestVirtualService", "test");

Web Config Changes

<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
               <probing privatePath="vservices"/>
        </assemblyBinding>
</runtime>

Folder Changes

Added a folder name vservices and dropped in the un-referenced TestVirtualService.dll

Hit F5 and everything worked perfectly.

Coordinator
Apr 3, 2011 at 7:47 PM

A couple of scenarios, by default it assumes you're calling a service from the same web url that SL is running from and dynamicly generates the endpoint from that. The virtual folder is part of the Url but ultimately is an indicator that informs ASP.NET when it receives any request for ~/vservices/someservice.svc to use the HSS VirtualFolder which in turn emulates an *.svc file ( this is the magic of the HSS Virtual Services - actually no magic, just leverages the already built in ASP.NET VirtualPath SubSystem ) which in turn gets executed like a normal WCF Service. If you're wanting to execute an HSS Virtual Service hosted at a different URL (and assuming you have a cross-domain policy), then you can provide an absolute path to the desired endpoint in the VirtualChannel Initalization method overload.

		public static void Initialize(EndpointAddress serviceEndpoint, string serviceToken, IDefaultCommunicationTimeouts timeouts = null)
		{
			if (VirtualChannel<TContract>.IsInitialized)
				return;
			VirtualChannel<TContract>.IsInitialized = true;
			VirtualChannel<TContract>.ServiceEndpoint = serviceEndpoint;
			VirtualChannel<TContract>.ServiceToken = serviceToken;
			VirtualChannel<TContract>.Timeouts = timeouts;
		}
In the end, the initialization method is just storing this information, so later when you call one of the operation methods, you don't have to provide all this information again and again.
Coordinator
Apr 4, 2011 at 3:20 AM

Also to clarify, the TestVirtualService.VService1,TestVirtualService is turned into an absolute URL of http://yourhost.com/vservices/TestVirtualService.VService1,TestVirtualService.svc

This is the end point of the Service. You could just as well provided that to the VirtualChannel Initialization versus it creating it based on the SL Url.

Apr 4, 2011 at 4:04 AM
Ok got it. Thanks for the support. Hope to see you new platform beta soon. Let me know.

Sent from my Windows Phone 7

From: hyspdrt
Sent: Monday, April 04, 2011 12:20 AM
To: galvesribeiro@hotmail.com
Subject: Re: How to send credentials to VirtualService [hsscore:252082]



> From: hyspdrt
>
> Also to clarify, the TestVirtualService.VService1,TestVirtualServiceis turned into an absolute URL ofhttp://yourhost.com/vservices/TestVirtualService.VService1,TestVirtualService.svcThis is the end point of the Service. You could just as well provided that to the VirtualChannel Initialization versus it creating it based on the SL Url.
>
>
Coordinator
May 26, 2011 at 4:39 AM
Edited May 26, 2011 at 4:40 AM

I have the Silverlight Application Platform done, now just working on documentation. Not sure how to enable it without giving it away. I also released (for sale) an embeddable SL4/WP7/.NET object database. Different than most others, extremely fast and light weight and super easy to use. http://highspeed-solutions.net/db.aspx

Thanks again