Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Authenticate by Passing Parameters

Warning

Do NOT expose clear text password in the URL or DOM.

Thai

รับรองความถูกต้องโดยผ่านพารามิเตอร์

English
For JSON API authentication purposes, the following parameters can be posted

...

to each of the JSON API URLs:
Thai

สำหรับวัตถุประสงค์ในการรับรองความถูกต้องของ JSON API พารามิเตอร์ต่อไปนี้สามารถโพสต์ / ผนวกเข้ากับแต่ละ URL ของ JSON API:

...


Assuming the username and password required is "user1" and "password1" respectively, we can post the username and password to the JSON API using following jQuery script.

Thai

สมมติว่าชื่อผู้ใช้และรหัสผ่านที่ต้องการคือ "user1" และ "password1" ตามลำดับเราสามารถโพสต์ชื่อผู้ใช้และรหัสผ่านไปยัง JSON API โดยใช้สคริปต์ jQuery ต่อไปนี้

Code Block
languagebash
titleSample Call
curl --location --request POST --data 'j_username=user1&j_password=password1' 'http://localhost:8080/jw/web/json/workflow/assignment/list/pending?j_username=user1&j_password=password1'
Code Block
languagebash
titleSample Result
{"total" : 12 }

...

Note

Please note that the support on Hashed Password is based on the Directory Manager you are using. Some Directory Manager Plugin may not supporting this type of authentication method.

The format and hashing method may vary for each Directory Manager as well.

Thai

โปรดทราบว่าการสนับสนุนรหัสผ่านที่แฮชจะขึ้นอยู่กับตัวจัดการไดเรกทอรีที่คุณใช้งานอยู่ ปลั๊กอินตัวจัดการไดเรกทอรีบางตัวอาจไม่สนับสนุนวิธีการรับรองความถูกต้องประเภทนี้

รูปแบบและวิธีการแฮชอาจแตกต่างกันสำหรับแต่ละตัวจัดการไดเรกทอรีเช่นกัน

Code Block
languagejsbash
titleSample Call
curl --location --request POST --data 'j_username=user1&hash=D012B772672A55A0B561EAA53CA7734E'<script>
    $(document).ready(function(){
        $.ajax({
            type: "POST",
            url: 'http://localhost:8080/jw/web/json/workflow/assignment/list/pending',
          
Code Block
languagebash
titleSample Result
{"total" : 12 }  data: {
				j_username : 'user1',
 				hash : 'D012B772672A55A0B561EAA53CA7734E'
			},
            success: function(res) {
                console.log(res)
            },
            dataType: "json"
        });

    });
</script>


Master Login Username and Password

Warning

Do NOT expose clear text password in the URL or DOM.

Thai

Master ชื่อผู้ใช้และรหัสผ่าน

...

Thai

สมมติว่าชื่อผู้ใช้ล็อกอินหลักและรหัสผ่านล็อกอินหลักคือ "master" และ "master" ตามลำดับแฮชการล็อกอินหลักจะเป็น "E505CF727D214A68CB03DA25DA978500"

ตัวอย่างต่อไปนี้แสดงให้เห็นถึงวิธีการใช้ข้อมูลรับรองหลักเพื่อเข้าสู่ระบบในฐานะ "user1"

Code Block
languagejsbash
titleSample Call
curl --location --request POST --data 'j_username=master&j_password=master&loginAs=user1' <script>
    $(document).ready(function(){
        $.ajax({
            type: "POST",
            url: 'http://localhost:8080/jw/web/json/workflow/assignment/list'
Code Block
languagebash
titleSample Result
{"total" : 12 }/pending',
            data: {
				j_username : 'master',
 				j_password : 'master',
 				loginAs : 'user1'
			},
            success: function(res) {
                console.log(res)
            },
            dataType: "json"
        });
    });
</script>



Using master login hash:

Thai

การใช้แฮชล็อกอินหลัก:



Code Block
languagejsbash
titleSample Call
curl --location --request POST --data 'j_username=master&j_password=master&loginAs=user1' <script>
    $(document).ready(function(){
        $.ajax({
            type: "POST",
            url: 'http://localhost:8080/jw/web/json/workflow/assignment/list'
Code Block
languagebash
titleSample Result
{"total" : 12 }/pending',
            data: {
				j_username : 'master',
 				hash : 'E505CF727D214A68CB03DA25DA978500',
 				loginAs : 'user1'
			},
            success: function(res) {
                console.log(res)
            },
            dataType: "json"
        });
    });
</script>


Basic Http Authentication

...

Since V4, Joget supports Basic HTTP Authentication in JSON API authentication , so you can passing pass the credentials in the header.

...


Assuming the username and password required is "user1" and "password1" respectively, we can set the Basic Auth header to the JSON API using following jQuery script.

Thai

สมมติว่าชื่อผู้ใช้และรหัสผ่านที่ต้องการคือ "user1" และ "password1" ตามลำดับเราสามารถตั้งค่าหัวข้อ Auth พื้นฐานเป็น JSON API โดยใช้สคริปต์ jQuery ต่อไปนี้

 

Code Block
languagejsbash
titleSample Call
curl --location --request POST <script>
    $(document).ready(function(){
        $.ajax({
            type: "POST",
            url: 'http://localhost:8080/jw/web/json/workflow/assignment/list/pending',
            beforeSend: function (xhr) {
    			xhr.setRequestHeader ("Authorization", "Basic dXNlcjE6cGFzc3dvcmQx");
			},
            success: function(res) {
                console.log(res)
            },
            dataType: "json"
        });
    });
</script>--header 'Authorization: Basic dXNlcjE6cGFzc3dvcmQx'
Code Block
languagebash
titleSample Result
{"total" : 12 }