Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master?rev=823397&r1=823396&r2=823397&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master (original) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master Fri Oct 9 04:04:55 2009 @@ -1,4 +1,5 @@ <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %> +<%@ Register assembly="Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="Microsoft.IdentityModel.Web.Controls" tagprefix="idfx" %> <% /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -58,10 +59,9 @@ <td> <a href = "Configuration.aspx">Config</a> </td> - <td> - <asp:LoginStatus runat="server" Id="LoginStatusLink" - LogoutText="Login/Logout" LoginText="Login/Logout" - OnLoggingOut="LoginStatusLink_LoggingOut" /> + <td><asp:LinkButton Text="Login/Logout" runat="server" ID="login" + onclick="login_Click" /> + </td> </tr> </table>
Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master.cs URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master.cs?rev=823397&r1=823396&r2=823397&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master.cs (original) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Site.master.cs Fri Oct 9 04:04:55 2009 @@ -16,6 +16,7 @@ // using System; using Trade.BusinessServiceClient; +using Microsoft.IdentityModel.Web; public partial class Site : System.Web.UI.MasterPage { @@ -23,14 +24,13 @@ { } - - protected void LoginStatusLink_LoggingOut(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e) + + protected void login_Click(object sender, EventArgs e) { if (Page.User.Identity.IsAuthenticated) { - string userid = Page.User.Identity.Name; - BSLClient businessServicesClient = new BSLClient(); - businessServicesClient.logout(userid); + FederatedAuthentication.SessionAuthenticationModule.SignOut(); + Response.Redirect("Default.aspx"); } } } Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/StockTrade.aspx.cs URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/StockTrade.aspx.cs?rev=823397&r1=823396&r2=823397&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/StockTrade.aspx.cs (original) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/StockTrade.aspx.cs Fri Oct 9 04:04:55 2009 @@ -17,6 +17,7 @@ using System; using System.Web; +using System.Web.Security; using Trade.BusinessServiceClient; using Trade.StockTraderWebApplicationModelClasses; using Trade.StockTraderWebApplicationSettings; @@ -32,7 +33,7 @@ protected void Page_Load(object sender, EventArgs e) { - string userid = HttpContext.Current.User.Identity.Name; + string userid = null; BSLClient businessServicesClient = new BSLClient(); string action = Input.InputText(Request["action"], 5) ?? string.Empty; Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/TradeHome.aspx.cs URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/TradeHome.aspx.cs?rev=823397&r1=823396&r2=823397&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/TradeHome.aspx.cs (original) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/TradeHome.aspx.cs Fri Oct 9 04:04:55 2009 @@ -36,7 +36,7 @@ decimal gain = (decimal)0.00; decimal percentGain = (decimal)0.00; TotalHoldingsUI totalHoldings; - string userid; + string userid = null; //Must get/decrypt FormsAuthentication ticket on this page only to get session created date for display. //Would recommend not displaying session create date if really do not need to; depending on @@ -51,10 +51,7 @@ //much faster than session state, the BIG advantage is that for deploying to web farms/clusters you never //have to worry about using ASP.NET state server or database configuration; it's "cluster-safe/webfarm-ready" //out of the box. - HttpCookie authcookie = Request.Cookies[FormsAuthentication.FormsCookieName]; - FormsAuthenticationTicket ticket = (FormsAuthenticationTicket)FormsAuthentication.Decrypt(authcookie.Value); - userid = ticket.Name; - SessionCreateDate.Text = ticket.IssueDate.ToString(); + BSLClient businessServicesClient = new BSLClient(); AccountDataUI customer = businessServicesClient.getAccountData(userid); totalHoldings = businessServicesClient.getHoldings(userid); Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config?rev=823397&r1=823396&r2=823397&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config (original) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config Fri Oct 9 04:04:55 2009 @@ -1,5 +1,4 @@ <?xml version="1.0"?> - <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -16,7 +15,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use @@ -26,31 +24,30 @@ \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> - + <configSections> + <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> + </configSections> <appSettings> - <!--Possible values for logger mode: CONSOLE, EVENT_VIEWER--> <add key="LOGGER_MODE" value="CONSOLE"/> <add key="EVENT_LOG" value="Trade Web App"/> <add key="LOGGING_ENABLED" value="ON"/> - <add key="MAX_DISPLAY_ORDERS" value="20"/> <add key="MAX_DISPLAY_TOP_ORDERS" value="5"/> <add key="DISPLAY_DUPLICATE_KEY_EXCEPTIONS" value="true"/> <add key="CHECK_ORDER_ALERT_EVERY_REQUEST" value="true"/> <add key="ORDER_ALERT_CHECK_FREQUENCY" value="30"/> <add key="CS_DOTNET_ENDPOINT_CONFIG_HTTP" value="ConfigClient_DotNet_BasicHttpBinding"/> - <add key="DOTNET_BS" value="BsClient_DotNet_BasicHttpBinding"/> - <add key="DOTNET_BSSEC" value="BsClient_DotNet_WsHttpBinding"/> + <add key="DOTNET_BS" value="BsClient_DotNet_FederatedBinding"/> + <add key="DOTNET_BSSEC" value="BsClient_DotNet_FederatedBinding"/> <add key="PHP_BS" value="BsClient_PHP_BasicHttpBinding"/> - <add key="WSAS_BS" value="BsClient_WSAS_BasicHttpBinding"/> - <add key="METRO_BS" value="BsClient_Metro_BasicHttpBinding"/> + <add key="JAVA_BS" value="BsClient_WSAS_BasicHttpBinding"/> <add key="BSL_USERID" value="bsloperationuser"/> <add key="BSL_PASSWORD" value="yyy"/> <add key="CLIENT_LABEL" value="DOTNET_CLIENT"/> <add key="BS_LABEL" value="DOTNET_BS"/> <add key="OPS_LABEL" value="DOTNET_OPS"/> - + </appSettings> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> @@ -67,53 +64,27 @@ <system.serviceModel> <!--This enables the WCF ServiceModel performance counters for this application.--> <diagnostics performanceCounters="All"></diagnostics> - - <!--******************************************************** + <!--******************************************************** Config Service BS Clients *********************************************************--> <client> - <!-- DotNet Config Endpoints --> - <endpoint address="http://localhost:7000/tradeconfigservice" - contract="Trade.ConfigServiceContract.IConfigService" - binding="basicHttpBinding" - name="ConfigClient_DotNet_BasicHttpBinding" /> - + <endpoint address="http://localhost:7000/tradeconfigservice" contract="Trade.ConfigServiceContract.IConfigService" binding="basicHttpBinding" name="ConfigClient_DotNet_BasicHttpBinding"/> + <!-- DotNet Clients --> <endpoint address="http://localhost:9000/tradebusinessservice" - contract="Trade.BusinessServiceContract.ITradeServices" - binding="basicHttpBinding" bindingConfiguration="BsClient_BasicHttpBinding" - name="BsClient_DotNet_BasicHttpBinding"/> - - <endpoint address="http://localhost:9000/tradebusinessservice/msec" - contract="Trade.BusinessServiceContract.ITradeServices" - binding="wsHttpBinding" bindingConfiguration="BsClient_WsHttpBinding_MSec" - behaviorConfiguration="BsClient_CertificateBehavior" - name="BsClient_DotNet_WsHttpBinding"> + contract="Trade.BusinessServiceContract.ITradeServices" + binding="customBinding" + bindingConfiguration="BsClient_DotNet_FederatedBinding" + behaviorConfiguration="BsClient_DotNet_FederatedBehavior" + name="BsClient_DotNet_FederatedBinding"> <identity> - <dns value="trade.com"/> + <dns value="BSL.Com"/> </identity> </endpoint> - - <!-- PHP Client --> - <endpoint address="http://localhost:8080/php_stocktrader/business_service/business_svc.php" - contract="Trade.BusinessServiceContract.ITradeServices" - binding="basicHttpBinding" bindingConfiguration="BsClient_BasicHttpBinding" - name="BsClient_PHP_BasicHttpBinding"/> - - <!-- WSAS Client --> - <endpoint address="http://localhost:9763/services/TradeServiceWsas" - contract="Trade.BusinessServiceContract.ITradeServices" - binding="basicHttpBinding" bindingConfiguration="BsClient_BasicHttpBinding" - name="BsClient_WSAS_BasicHttpBinding"/> - <!-- Sun Metro Client --> - <endpoint address="http://localhost:8090/business_service/TradeServiceWsas" - contract="Trade.BusinessServiceContract.ITradeServices" - binding="basicHttpBinding" bindingConfiguration="BsClient_BasicHttpBinding" - name="BsClient_Metro_BasicHttpBinding"/> </client> <!--******************************************************** @@ -122,72 +93,50 @@ *********************************************************--> <bindings> - <!--BEGIN basicHttpBindings--> - <basicHttpBinding> - - <!--THESE ARE TEMPLATE PRIMARY SERVICE CLIENT BINDINGS. TO AUGMENT, ADD WITH PREFIX 'Client_'--> - <binding name="BsClient_BasicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:1:00" allowCookies="true" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard" maxBufferSize="524288" maxBufferPoolSize="524288" maxReceivedMessageSize="524288" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> - <readerQuotas maxDepth="512" maxStringContentLength="262144" maxArrayLength="262144" maxBytesPerRead="65536" maxNameTableCharCount="262144"/> - <security mode="None"> - <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> - <message clientCredentialType="Certificate" algorithmSuite="Default"/> + <customBinding> + <binding name="BsClient_DotNet_FederatedBinding"> + <security authenticationMode="IssuedTokenForCertificate" + messageSecurityVersion="WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10"> + <issuedTokenParameters keyType="SymmetricKey" tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"> + <issuer address="http://localhost:9001/tradeactivests" binding="ws2007HttpBinding" bindingConfiguration="stsBinding"> + <identity> + <dns value="BSL.Com"/> + </identity> + </issuer> + <issuerMetadata address="http://localhost:9001/tradeactivests/mex"/> + </issuedTokenParameters> </security> + <httpTransport/> </binding> - - </basicHttpBinding> - + </customBinding> - <!--BEGIN wsHttpBindings--> - <wsHttpBinding> - - <binding name="BsClient_WsHttpBinding_MSec" closeTimeout="00:01:00" - openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" - bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" - maxBufferPoolSize="524288" maxReceivedMessageSize="65536" - messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" - allowCookies="false"> - <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> - <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> + <ws2007HttpBinding> + <binding name="stsBinding"> <security mode="Message"> - <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> - <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" /> + <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false" algorithmSuite="Default"/> </security> </binding> - - </wsHttpBinding> + </ws2007HttpBinding> </bindings> <!--Service Behaviors are applied (at the service level) to services that specify them, hence apply to ALL ENDPOINTS FOR A SERVICE HOST/VHOST --> <behaviors> <!--Endpint Behaviors are applied at the individual endpoint level.--> <endpointBehaviors> - <!-- - <behavior name="ClientCertificateBehavior"> - <clientCredentials> - <serviceCertificate> - <authentication certificateValidationMode="PeerOrChainTrust"/> - </serviceCertificate> - </clientCredentials> - </behavior> - --> - <behavior name="BsClient_CertificateBehavior"> + <behavior name="BsClient_DotNet_FederatedBehavior"> <clientCredentials> + <clientCertificate findValue="CN=Trade.Com" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectDistinguishedName"/> <serviceCertificate> - <authentication certificateValidationMode="PeerOrChainTrust"/> + <defaultCertificate findValue="CN=BSL.Com" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectDistinguishedName"/> + <authentication revocationMode="NoCheck" certificateValidationMode="None"></authentication> </serviceCertificate> </clientCredentials> </behavior> - <!-- - <behavior name="OPS_ClientCertificateBehavior"> - <clientCredentials> - <clientCertificate findValue="BSL.Com" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="TrustedPeople"/> - </clientCredentials> - </behavior>--> </endpointBehaviors> </behaviors> <!--END CONFIG SERVICE TEMPLATE BEHAVIORS--> - </system.serviceModel> + <!-- Set identity impersonate to false to make sure ASP.NET runs as its preferred ASP.NET Machine Account. Note this is also required for the application by default to run in a Windows Vista/ASP.NET worker process @@ -210,24 +159,23 @@ during development. --> <customErrors mode="Off"></customErrors> - <pages buffer="true" enableSessionState="false" enableViewState="false" enableViewStateMac="false" smartNavigation="false"> + <pages buffer="true" enableSessionState="true" enableViewState="false" enableViewStateMac="false" smartNavigation="false"> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> - <compilation defaultLanguage="c#" debug="true"> - <assemblies> + <compilation defaultLanguage="c#" debug="true"> + <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> + <add assembly="Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies> - </compilation> - <authentication mode="Forms"> - <forms name="signinform" loginUrl="login.aspx" protection="None" timeout="15"/> - </authentication> + </compilation> + <authentication mode="None"/> + <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs @@ -240,7 +188,12 @@ <error statusCode="404" redirect="FileNotFound.htm"/> </customErrors> --> - <sessionState mode="Off" cookieless="false" stateConnectionString="" timeout="15"/> + <sessionState mode="InProc" cookieless="false" stateConnectionString="" timeout="15"/> + <httpModules> + <!-- <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> --> + <add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> + <add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> + </httpModules> </system.web> <system.codedom> <compilers> @@ -294,13 +247,50 @@ </authorization> </system.web> </location> - <!-- Note: Uncomment this section to move .ascx output caching of MarketSummaryto kernel mode - <system.webServer> - <caching> + <system.webServer> + <validation validateIntegratedModeConfiguration="false"/> + <modules> + <!-- <remove name="ScriptModule"/> + <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> +--> + <add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler"/> + <add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler"/> + </modules> + <!-- Note: Uncomment this section to move .ascx output caching of MarketSummaryto kernel mode + <caching> <profiles> <add extension=".ascx" policy="DontCache" kernelCachePolicy="CacheForTimePeriod" duration="00:01:00" /> </profiles> </caching> - </system.webServer> --> -</configuration> \ No newline at end of file + </system.webServer> + <microsoft.identityModel> + <service> + <audienceUris> + <add value="http://localhost/trade/"/> + </audienceUris> + <federatedAuthentication> + <wsFederation passiveRedirectEnabled="true" issuer="http://localhost/trade_identity/" realm="http://localhost/trade/" requireHttps="false"/> + <cookieHandler requireSsl="false"/> + </federatedAuthentication> + <serviceCertificate> + <certificateReference x509FindType="FindBySubjectDistinguishedName" + findValue="CN=Trade.Com" + storeLocation="LocalMachine" + storeName="TrustedPeople"/> + </serviceCertificate> + <applicationService> + <claimTypeRequired> + <!--Following are the claims offered by STS 'http://localhost/StonehengeSTS/', and added at 6/4/2009 3:59:30 PM. Add or uncomment claims that you require by your application and then update the federation metadata of this application.--> + <!--<claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true"/> + <claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true"/>--> + </claimTypeRequired> + </applicationService> + <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> + <trustedIssuers> + <add thumbprint="AF5520A014847A1D2A342F800923B917DF3A74FD" name="CN=Trade.Com"/> + </trustedIssuers> + </issuerNameRegistry> + </service> + </microsoft.identityModel> +</configuration>