1 / 52

מימוש תקן ws.il עם WCF

מימוש תקן ws.gov.il עם WCF. שי אליאס מנהל צומת השירותים הממשלתי תהילה, ממשל זמין shaye@tehila.gov.il 02-6664666. WS-Security (Web Services Security). Communication protocol providing a means for applying security to web services .

matty
Download Presentation

מימוש תקן ws.il עם WCF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. מימוש תקן ws.gov.il עם WCF שי אליאס מנהל צומת השירותים הממשלתי תהילה, ממשל זמין shaye@tehila.gov.il 02-6664666

  2. WS-Security (Web Services Security) • Communication protocol providing a means for applying security to web services. • The protocol contains specifications on how integrity and confidentiality can be enforced on web services messaging. • contains specifications on how integrity and confidentiality can be enforced on web services messaging. The WSS protocol includes details on the use of SAML and Kerberos, and certificate formats such as X.509. • WS-Security incorporates security features in the header of a SOAP message, working in the application layer. Thus it ensures end-to-end security.

  3. יצירת תעודה (certificate) למכונה • להוריד את הקובץ Config_WS_WSE3.zip • לעשות extract לקובץ zip • להריץ את cert_request.bat • בשלב זה יווצר בספריה Config_WS_WSE3 קובץ ששמו <hostname>.txt כאשר <hostname> הוא שם המכונה. • בשלב זה גם נוצר ה private key בספריה: C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys • להעביר לצוות PKI של תהילה את הקובץ <hostname>.txt שנוצר ולציין שזוהי בקשה לסרטיפיקט בשימוש עם WSE 3.0. • צוות PKI של תהילה ינפיק עבורכם קובץ בשם <hostname>.cer.txt • יש לשנות את שם הקובץ ל <hostname>.cer למקמו ב Config_WS_WSE3 ולהריץ את cert_accept.bat

  4. בדיקה התעודה - 1 לבדוק שהתעודה נמצאת תחת: Certificates (Local Computer) -> personal -> Certificates

  5. בדיקת התעודה - 2 לוודא שיש private key

  6. העתקת מפתח ציבורי במכונה שבה נמצא המפתח הפרטי מבצעים Export לתעודה, לא כולל מפתח פרטי. במכונה שצריכה לזהות את החתימה מבצעים import לתעודה.

  7. הגדרות בצד השרת הגדרות בצד השרת

  8. תוספת בקוד השרת • שממשל זמין דורש חתימה בלבד, יש להוסיף הגדרה זו ברמת ה contract בקוד כדלקמן:

  9. תוספת ב Web.Config • על מנת שיהיה אפשר לגלוש ל wsdl של ה service יש לציין זאת ב web.config :

  10. פתיחת Microsoft service configuration editor Open from SDK Open from Visual Studio 2008

  11. פתיחת Microsoft service configuration editor

  12. הגדרת Host של ה WebService תחת הגדרות ה Host של ה Service יש להגדיר BaseAddress (זוהי הכתובת של התיקיה הוירטואלית ב IIS בתוכה נמצאים כל קבצי ה services)

  13. כך תיראה הגדרת BaseAaddress

  14. הגדרת Binding • קיים wsHttpBinding שמגיע out of the box בהתקנת WCF – אולם אינו מתאים להגדרות של ה DataPower • נשתמש ב custom binding • בנוסף נפרסם MexHttpBinding ע"מ שה DataPower יוכל לשלוף באופן דינמי קבצי wsdl

  15. wsHttpBinding הקיים נראה כך

  16. נייצר Binding חדש מסוג CustomBinding אותו נשייך מאוחר יותר ל Endpoint

  17. בוחרים CustomBinding

  18. הגדרת security ל Binding

  19. הגדרת Security הגדרות הSecurity של ה Binding (שימו לב טוב טוב שהכל מתאים!!!!!) במיוחד להגדרה של MessageSecurityVersion : WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10

  20. הגדרות httpTransport של ה Bindings.

  21. הגדרות textMessageEncoding של ה Binding

  22. נעבור להגדרות של ה Endpoint וניצר Endpoint חדש.

  23. שיוך ה CustomBinding שיצרנו ל Endpoint שיצרנו נבחר customBinding ונדאג לשייך אליו את ה customBinding שיצרנו. בנוסף יש להגדיר עבורו Address רלוונטי או קבוע וגם לבחור contract.

  24. יצירת EndPoint נוסף ניצר endpoint נוסף עם MexHttpBinding (חשוב ע"מ לאפשר שליפת קבצי wsdl באופן דינמי עבור ה DataPower).

  25. הגדרת Behavior נעבור להגדרות של ה Service Behavior תחת Advanced וניצר behavior חדש.

  26. הוספת תכונות ל Behavior: הראשונה ServiceMetada – איפשור גישה ב HTTP ל WS

  27. הוספת תכונות ל Behavior: ב serviceMetadata להגדיר HttpGetEnabled=True

  28. הוספת תכונות ל Behavior: השניה ServiceCredentials – הגדרת סרטיפיקטים

  29. סרטיפיקטים – צד שרת: נגדיר את ה service certificate, ה find value הוא שם ה certificate של השרת שמפרסם את השירות.

  30. הגדרת הצרכן של השירות

  31. הוספת תכונות ל Behavior: השלישית הגדרת כתיבה ל EVENT VIEWER

  32. שיוך ה Behavior ל Service

  33. הגדרות בצד השרת הגדרות בצד הלקוח

  34. הגדרות בצד ה client • שינויים בקוד: • נייצר reference ל service: serviceRef.ServiceClient WcfRef = new serviceRef.ServiceClient(); • אחרי יצירת reference ל service בקוד יש לעדכן בו את ה property הבא: WcfRef.Endpoint.Contract.ProtectionLevel = System.Net.Security.ProtectionLevel.Sign;

  35. הגדרות ראשוניות

  36. הוספת Custom Binding

  37. נוסיף לו Security

  38. הגדרות Security

  39. הגדרת TestMessageEncoding

  40. הגדרת HttpTransport

  41. נעבור להגדרת EndPoint Behavior חשוב לתת שם – במקרה שלנו :TehilaWCFClientBehavior ונוסיף לו ClientCredentials

  42. הגדרות ה Behavior תחילה נגדיר מי יחתום על ה – מי הסרטיפיקט של הקליינט

  43. הגדרות ה Behavior ומי הסרטיפיקט של הסרבר – ממי צורכים את השירות

  44. הגדרות ה Behavior ולבסוף:

  45. שיוך ה Behavior שייצרנו חוזרים ל Endpoints ,משנים את ה Endpoints שייצרנו ל Custom Binding ומשייכים אליו את ה Behavior שייצרנו :

  46. שינוי ערך DNS בתגית Identity של ה ClientEndpoint

  47. הגדרות בצד השרת כלי ניתור וטיפול בבעיות

  48. כלי Diagnostics

  49. דוגמת לוג

More Related