Get claims for service using Windows validation

I have the following code which was validation using username & password. How can I use Windows credentials instead?
private static SecurityToken GetClaims(string serviceurl, string username, string password)
bool isincurrentusercontext = String.IsNullOrEmpty(username);
WS2007HttpBinding binding = new WS2007HttpBinding();
binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
binding.Security.Message.EstablishSecurityContext = false;
EndpointAddress endpoint = new EndpointAddress(new Uri(GetStsUrl(isincurrentusercontext)));
WSTrustChannelFactory trustChannelFactory;
if (!isincurrentusercontext)
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
trustChannelFactory = new WSTrustChannelFactory(binding, endpoint);
trustChannelFactory.Credentials.UserName.UserName = username;
trustChannelFactory.Credentials.UserName.Password = password;
else
trustChannelFactory = new WSTrustChannelFactory(new KerberosWSTrustBinding(SecurityMode.TransportWithMessageCredential), endpoint);
trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;
trustChannelFactory.Credentials.UseIdentityConfiguration = true;
WSTrustChannel channel = null;
RequestSecurityToken rst = new RequestSecurityToken(RequestTypes.Issue);
rst.AppliesTo = new EndpointReference(serviceurl);
rst.KeyType = KeyTypes.Bearer;
channel = (WSTrustChannel)trustChannelFactory.CreateChannel();
SecurityToken token = channel.Issue(rst);
((IChannel)channel).Close();
channel = null;
trustChannelFactory.Close();
trustChannelFactory = null;
return token;
If I change credential type from username to Windows,
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
and remove these two statements,
trustChannelFactory.Credentials.UserName.UserName = username;
trustChannelFactory.Credentials.UserName.Password = password;
and when i try to get the token, 
SecurityToken token = channel.Issue(rst);
I get the following error,
"Secure
channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or
implied by the EndpointAddress correctly identifies the remote endpoint"

Hi,
For Client configuration, in order for the service-client communication to work we need to specify the security type and the ClientCredentialType. These settings must match the security settings in the service.
For more information, you could refer to:
http://www.felinesoft.com/blog/index.php/2014/02/securing-a-wcf-service-with-username-and-password-using-message-security-and-the-channel-factory-pattern/
Regards

Similar Messages

  • I have an old scanner HP6200c can I get drivers for it using windows 7 technology

    Can anyone help me find drivers for an old HP  6200 c scanner
    This question was solved.
    View Solution.

    IF that Resolved your stated Question and Problem, please designate as Solved, with Kudos (if deserved).
    Largely volunteer forum participants, with a few HP employees.

  • HT204053 I am trying to sign up for icloud using windows 7. When I enter my apple id it says "this is a valid apple id but is not an icloud account". Where do I create an icloud account?

    I am trying to sign up for icloud using windows 7. When I enter my apple id it says "this is a valid apple id but is not an icloud account". Where do I create an icloud account?

    I already quoted the minimum requirements, look in the post before yours.
    You will have to upgrade your Mac to at least 10.7.5, upgrades are not free, you buy them from the App Store. Mountain Lion is the best but your Mac must be compatible.
    Here is a list of compatible machines.
    Also note that some older apps (Office 2004, Appleworks) will not run on Mountain Lion.

  • HT5192 unable to download ios 5.0 for ipad using windows 7 and itunes 10.1

    I am unable to upgrade to ios 5.0 for my ipad. I am using windows 7 and my itunes is updated 10.1   it keeps timimg out and i get error message 3259.  I already tried diacbling antivirus software

    You've tried turning off all firewall and antivirus software ? If that doesn't work then you could try downloading the 5.1.1 update via a browser :
    original iPad
    iPad 2 wifi
    iPad 2 gsm/sim
    iPad 2 CDMA
    iPad 2 new
    iPad 3 wifi
    iPad 3 gsm
    iPad 3 CDMA
    When it's finished downloading, in your computer's iTunes press and hold the shift key on Windows (command key on Mac) when clicking the Check For Updates button which should let you navigate to the downloaded file.

  • HT201413 I cannot get home sharing working, using windows 8 . does anyone have a solution?

    i cannot get home sharing on itunes to work using windows 8. I also have Norton 360 and have unstalled and disabled it but still cannot get home sharing to operate so that i can use the remote APP on my ipad to control music through the house. does anyone have a solution or experienced similar issue?

    Hi Pat,
    Yes I marked the question as Assumed Answered. I needed to move on. I have never taken part in a forum and couldn’t wait any longer for any input so not wanting anyone to waste the time answering me, I marked the question as assumed answered. I guess this was the wrong thing to do and I apologize to the forum.
    I did go another route and loaded and enlarged the photo in Photoshop Elements, Then cropped the photo to the area I needed to reprint. I probably should have done this in the first place!
    Again, my apology to the forum for my lack of patience in waiting for a reply.
    Diane Harris
    Sent from Windows Mail

  • HT3986 I have a Macbook Pro, have recently upgraded to OS 7, have installed the bootcamp option, and am not getting any sound with using windows applications.

    I am getting no sound with I use windows programs on my Macbook Pro. I am operating with the bootcamp option. The sound works fine with I am running the MAC OS 7
    I read that my problem could be a driver, but I am unsure how to get this driver and how to install it.

    Read the Boot Camp installation guide http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.7.pdf. You download the drivers during the installation process. Then you install the downloaded drivers after booting into Windows. You can also go to the source to get the sound drivers for your comuter. Search this forum and you will find posts with the url  from which to download the drivers.

  • Where can I get iTunes for 64 bit Windows XP?

    I am running Windows XP 64 bit Pro. I downloaded iTunes for Windows, started setup and I got message which says that I should download 64 bit iTunes version.
    So where can I get iTunes for Windows XP 64 bit?

    According to the following document, iTunes is not supported for 64 bit XP
    http://support.apple.com/kb/HT1426
    CG

  • Rendering from AECS5 (Mac) for someone using Windows Media Player 11?

    Does anyone know if it's possible, and if so what settings, I could render out of AECS5 on a Mac to a format someone using Window Media Player 11 in Windows XP so they could view the file?
    They are unable to install any other software or codecs other than what comes stock with the XP install.
    Any advice would be much appreciated!
    Thanks,
    Kristin.

    MPEG-2 should work. If you include audio, you will get a .mpg file which WMP should play.
    Edit: Sorry, I am wrong about that; they would need to have a DVD decoder pack installed which apparently doesn't come standard.
    Here are two links that don't have an answer, but have info about the problem:
    http://help.adobe.com/en_US/aftereffects/cs/using/WS3878526689cb91655866c1103a4f2dff7-79f1 a.html
    http://support.microsoft.com/kb/316992

  • How can I download Photoshop for OSX using Windows?

    Dear all:
    Hi. I need to download Photoshop trial for OSX (in order to test the product on an iMac) but I'm using Windows so it seems the Download Manager automatically tries to download the Windows version od Photoshop instead of the OSX version. How can I change that?.
    Best Regards

    CarlosNegroni you can download a Mac version by initiating a direct download.  Please see http://forums.adobe.com/thread/981369 for more information on how to accomplish this.

  • Miro for services using bapi_incominginvoice_create

    i need to automate miro for services.
    Please help how I can do this with code using above BAPI.
    Thanks

    Dear all,
                     It will be very helpful & ll be thankful if any ideas shared to overcome below issue.
                   I was trying to create invoice using BAPI_incoming_invoice of service document type.the invoice is created but while checking in accounting data amount is gone for coin adjustment,which is wrong as per my functional.
    My code & outcome is are attached.
    REPORT ZBAPI_AUTO_MIRO_SERVICES.
    DATA: headerdata TYPE bapi_incinv_create_header,
           itemdata TYPE TABLE OF  bapi_incinv_create_item,
           ls_itemdata TYPE  bapi_incinv_create_item,
           ls_accountingdata type bapi_incinv_create_account,
           accountingdata type table of bapi_incinv_create_account,
           return  TYPE TABLE OF  bapiret2,
           ls_return TYPE bapiret2,
           invoicedocnumber  LIKE  bapi_incinv_fld-inv_doc_no,
           fiscalyear  LIKE  bapi_incinv_fld-fisc_year,
           taxdata TYPE TABLE OF bapi_incinv_create_tax,
           ls_taxdata TYPE bapi_incinv_create_tax,
           gldata  TYPE TABLE OF bapi_incinv_create_gl_account,
           ls_gldata TYPE bapi_incinv_create_gl_account,
           vsplit TYPE TABLE OF bapi_incinv_create_vendorsplit,
           ls_vsplit TYPE bapi_incinv_create_vendorsplit.
    DATA:counter TYPE i.
    DATA: it_exload LIKE alsmex_tabline  OCCURS 0 WITH HEADER LINE.
    DATA:BEGIN OF it_final OCCURS 0,
          doc_date(8),
          doc_type(2),
          ref_doc_no(20),
          pstng_date(8),
          comp_code(4),
          diff_inv(10),
          currency(3),
          gross_amount(13),
          exch_rate(6),
          header_txt(25),
          del_costs_taxc(2),
          alloc_number(20),
          bus_area(4),
          item_text(50),
          business_place(4),
          invoice_doc_item(6),
          po_number(10),
          tax_code(2),
          item_amount(13),
          po_item(5),
          quantity(5),
          po_unit(2),
          cond_type(4),
          freight_ven(10),
          INVOICE_DOC_ITEM1(6),
          SERIAL_NO1(2),
          TAX_CODE1(2),
          ITEM_AMOUNT1(13),
          QUANTITY1(5),
          PO_UNIT1(2),
    END OF it_final.
      headerdata-invoice_ind = 'X'.
       headerdata-CALC_TAX_IND = 'X'.
       headerdata-doc_type  = 'RE'.
       headerdata-doc_date    = '20150309'.
       headerdata-ref_doc_no =  'GDFGDFG'.
       headerdata-pstng_date  = '20150309'.
       headerdata-comp_code  = 'VALC'.
    *  headerdata-diff_inv   = '0000203495'.
       headerdata-currency = 'INR'.
       headerdata-gross_amount = '657.30'.
       headerdata-exch_rate = '1.00000'.
       headerdata-PMNTTRMS = '0001'.
       headerdata-bline_date = '20150309'.
       headerdata-bus_area =   '3001'.
       headerdata-header_txt = 'abcddfghvkj'.
    *  headerdata-del_costs_taxc = it_final-del_costs_taxc."'P0'.
       headerdata-alloc_nmbr = 'BVKJFDLNV'.
       headerdata-item_text = 'BJFDBVKBDSVK'.
       headerdata-business_place = '1000'.
    ls_itemdata-invoice_doc_item = '000001'.
       ls_itemdata-po_number = '6600003195'.
       ls_itemdata-po_item = '00010'.
       ls_itemdata-tax_code = 'S1'.
       ls_itemdata-item_amount = '585.00'.
       ls_itemdata-quantity = '3'."it_final-quantity.
       ls_itemdata-po_unit  = 'NO'.
       ls_itemdata-ref_doc = '1000363624'.
       ls_itemdata-ref_doc_it = '001'.
       ls_itemdata-REF_DOC_YEAR = '2015'.
       ls_itemdata-SHEET_NO = '1000363624'.
       ls_itemdata-SHEET_ITEM = '0000000010'.
       APPEND ls_itemdata TO itemdata.
       CLEAR ls_itemdata.
    PERFORM COMMIT_WORK.
    FORM COMMIT_WORK.
    *  LOOP AT taxdata.
         CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
         EXPORTING
           headerdata       = headerdata
    **   ADDRESSDATA         =
         IMPORTING
           invoicedocnumber = invoicedocnumber
           fiscalyear       = fiscalyear
         TABLES
           itemdata         = itemdata
    *   accountingdata      = accountingdata
    *      glaccountdata    = gldata
    *     MATERIALDATA     = matdata
    *     TAXDATA          = taxdata
    **   WITHTAXDATA         =
    **   VENDORITEMSPLITDATA =
           return           = return.
    **   EXTENSIONIN         =
    **   TM_ITEMDATA         =
    **   NFMETALLITMS        =
       IF return IS NOT INITIAL.
         LOOP AT return INTO ls_return WHERE type = 'E'.
           FORMAT INTENSIFIED.
           WRITE: / ls_return-message COLOR 6.
           FORMAT INTENSIFIED OFF.
         ENDLOOP.
       ELSE.
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             wait   = 'X'
           IMPORTING
             return = ls_return.
         IF sy-subrc = 0 .
           FORMAT INVERSE .
           WRITE:  'Invoice & Created Successfully' COLOR 5,invoicedocnumber COLOR 5 .
           FORMAT INVERSE OFF.
         ENDIF.
       ENDIF.
    CLEAR headerdata.
    REFRESH itemdata.
    REFRESH accountingdata.
    REFRESH TAXDATA.
    *ENDLOOP.
    ENDFORM.

  • Deploying the Cloud service using Windows Authentication

    Hi,
    I have a VPN Connectivity established to other VM Server where the DB is also installed. Now I a have created an application with DB connectivity
    I am able to connect the DB server using SQL authentication but how can I connect using Windows Authentication?
    What configuration changes I have to do in web.config or I have to modify any more changes else where?
    Thanks & Regards,
    Suresh Sahu

    Hi,
    Based on your description, you have connected to DB server using SQL authentication, I suggest your read the following link, and do some change in SQL that installed in the VM, hope it helps. If I misunderstand, please feel free to let me know.
    #http://msdn.microsoft.com/en-us/library/dd787978.aspx
    Best Regards

  • Code 10 error for touchscreen using windows 8

    We have a HP 42" monitor (LD4200tm) and the touchscreen feature does not work and we have a code 10 error - device not working. The panel works fine using Windows 7 and the drivers appear to be the most updated.

    Hi: See if this works... Download but don't run this driver... The package contains Broadcom Wireless LAN driver. It is required to enable integrated Broadcom Wireless LAN adapter. File name: sp68301.exe Go to the device manager, right click on the problem Broadcom wireless adapter. Select Uninstall and check the Uninstall Driver box. Reboot and see if installing the driver I posted above installs the device properly.

  • Get Conditions for Service sub positions

    Hello , i use a purchase order form this FM RV_PRICE_PRINT_ITEM to get conditions of position but in case of service position which have sub-position with they own conditions i can't find how get that conditions y search the tables konp,konh, KONV
    but i don't find a way to get the data for sub-position of services  any idea about this ?
    Thanks.

    We used Badi - BBP_CREATE_REQ_BACK para agrupar posiciones

  • Contract data not getting copied for service ticket follow up complaint.

    Hi Experts,
    We are creating a complaint as a follow-up document to service ticket . But the contract data is not getting copied.
    We contacted SAP and they told us that its a standard behavior .The reply is basically an SAP note
    841830 - Contract data not copied to follow-up transaction
    My question is is there a way to change this behavior using CRM_COPY_BADI ?
    I tried to look for the method which I can implement to get the contract data in items, But I was not able get it .
    Please suggest the way to get it working
    Thanks in advance .
    Naval

    Please not that the contract determination works fine when creating a new complaint ... but when the I am trying to create a complaint from service ticket the item level contract determination is not working fine ...
    We have configured that the contract should be determined at the item level only option `F`.
    I checked in one of the sap document that this cant be achieved by standard .
    http://help.sap.com/saphelp_crm70/helpdata/en/46/5cd7335bbd516fe10000000a114a6b/frameset.htmhttp://help.sap.com/saphelp_crm70/helpdata/en/46/5cd7335bbd516fe10000000a114a6b/frameset.htm
    Is there a way we can put this code in the BADI eg; CRM_SERVICE_CONTRACT ?? Please note that there is already an implementation of CRM_SERVICE_CONTRACT which is working fine for new service document creation .

  • Soap handlers not getting invoked for service control

    Is it possible to attach soap handlers to the service control generated from a wsdl file.
    The below link shows that we can add handlers to a service control but it doesn't work for me
    http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
    Below is the code I am using to declare the handler
    * @jc:location http-url="https://rrad.carrierzone.com/rrad/server.php"
    * @jc:wsdl file="#RRADServiceWsdl"
    * @jc:handler callback="WebHostingHandler" operation="WebHostingHandler"
    public interface rradsslControl extends com.bea.control.ControlExtension, com.bea.control.ServiceControl
    Everything works perfect If I add a soap-handler to a webservice
    Thanks,
    Sridhar

    Sridhar,
    WLW doesn't support SOAP message handlers on messages that arrive via HTTP GET. If you are using the test console you need to use the Test XML page instead of the test form page
    Additional info is available at http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/getstarted/conSOAPHandlers.html
    Also when referring to Workshop docs links, please use the URL listed at the bottom of the page. The URL from the browser address bar will also be http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
    Cheers
    Raj

Maybe you are looking for

  • Sometimes after putting my iMac to sleep, I can't get it to wake up and have to turn it off at the mains. Any ideas why?

    Sometimes after putting my iMac to sleep, I cannot get it to wake up again. It's as if it's shut down and I have to turn it off at the mains and restart it.  Any ideas why? Does this keep happening to anybody else?

  • Can I make a DVD using Quicktime or anything else in my arsenal?

    First off I apologize for m idiocracy in posting this in "Quicktime for Windows" before this as I simply was noy paying any attention, also, please forgive me what I am about to ask has been discussed, but I didn't find any answers in my searching so

  • Query on sc3.0

    Hi, In sun cluster 2.2, i saw the concept of logical hosts being configured with the disksets. And we can change the mastery of the disk groups among the nodes using the haswitch command. How this concept works in Sun cluster 3.0. I didn't get clear

  • Loading Textures in the Filter Gallery Texturizer

    I created a few seamless tiles in PSD format to be loaded into the Texturizer filter under the Filter Gallery in CS6 on a Windows 7 machine. In the flyout menu, there is an option to LOAD a new texture. I loaded four or five new ones, but only the la

  • Perian 0.5 for mac os x 10.3

    Yes hi i need to download perian 0.5 for mac for qt 7. Because i have this cancorder and i cant play the videos in Quicktime cuz i need some sort of codec. So seen this codec "perian" for mac and there is v1.1.4,and v1.1.4 cant run on panther. So i t