การเชื่อมต่อ OAuth2 ด้วย .NET C#

อยาก  Login ด้วย OAuth2 กับ .NET C# ต้องทำอย่างไร              สำหรับตัวอย่างนี้เอามาจาก GitHub Project : https://github.com/titarenko/OAuth2[1] ซึ่งเป็น Code ตัวอย่างนำมาเพิ่ม ในส่วนของการเชื่อมต่อ PSU Passport ดังนี้ เพิ่ม class file ใน project OAuth2->Client->Impl ชื่อ PassportClient.cs เนื้อหาดังนี้ using Newtonsoft.Json.Linq; using OAuth2.Configuration; using OAuth2.Infrastructure; using OAuth2.Models; namespace OAuth2.Client.Impl { /// <summary> /// Passport authentication client. /// </summary> public class PassportClient : OAuth2Client { /// <summary> /// Initializes a new instance of the <see cref=”PassportClient”/> class. /// </summary> /// <param name=”factory”>The factory.</param> /// <param name=”configuration”>The configuration.</param> public PassportClient(IRequestFactory factory, IClientConfiguration configuration) : base(factory, configuration) { } /// <summary> /// Defines URI of service which issues access code. /// </summary> protected override Endpoint AccessCodeServiceEndpoint { get { return new Endpoint { BaseUri = “https://oauth.psu.ac.th”, Resource = “?oauth=authorize” }; } } /// <summary> /// Defines URI of service which issues access token. /// </summary> protected override Endpoint AccessTokenServiceEndpoint { get { return new Endpoint { BaseUri = “https://oauth.psu.ac.th”, Resource = “?oauth=token” }; } } /// <summary> /// Defines URI of service which allows to obtain information about user which is currently logged in. /// </summary> protected override Endpoint UserInfoServiceEndpoint { get { return new Endpoint { BaseUri = “https://oauth.psu.ac.th”, Resource = “?oauth=me” }; } } /// <summary> ///

Read More »

Workshop : PSU Passport OAuth2

มีวิธี Authen แบบอื่นนอกจาก LDAP กับ Web Service ไหม             ด้วยยุคสมัยเปลี่ยนไป ด้วยเทคโนโลยี OAuth2 ทำให้เราจำเป็นต้องศึกษาหาความรู้เพิ่มเติมกันอีกครั้งครับ หมายเหตุ : เนื่องจากต้องการให้เป็น Blog เปิดเผยได้ จึงขอไม่ระบุชื่อ Server จริง ๆ ลงไปนะครับ  โดยรวบรวม Blog แบ่งเป็น 7 Blog ดังนี้ Blog ที่ ชื่อ Blog      1 เรียนรู้เทคโนโลยี OAuth2      2 การติดตั้ง Postman      3 ทดสอบเชื่อมต่อ OAuth2 ด้วย Postman      4 การเชื่อมต่อ OAuth2 ด้วย Joomla      5 การเชื่อมต่อ OAuth2 ด้วย Wordpress      6 การเชื่อมต่อ OAuth2 ด้วย .NET C#      7 การเชื่อมต่อ OAuth2 ด้วย PHP (กำลังดำเนินการ) บทความและ Link เพิ่มเติม [1] การยืนยันตัวตนและกำหนดสิทธิ์ Apache UserGrid 2.x [2] รวม Code สำหรับเชื่อมต่อ OAuth ทุกภาษา 1 : https://oauth.net/code/ [3] รวม Code สำหรับเชื่อมต่อ OAuth ทุกภาษา 2 : https://developer.byu.edu/docs/consume-api/use-api/follow-sample-code

Read More »