-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
154 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
only for saml2.0 dev | ||
""" | ||
|
||
from django.views import View | ||
from django.shortcuts import render | ||
|
||
|
||
class LoginView(View): | ||
""" | ||
模拟OneID的登录页面 | ||
run as FE | ||
""" | ||
def get(self, request): # pylint: disable=no-self-use | ||
""" | ||
arkid login | ||
""" | ||
token_url = '/siteapi/v1/ucenter/login/' | ||
return render(request, 'dev/mock_login.html', context={'token_url': token_url}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{#oneid_base_url需要更改为本地开发环境IP:port#} | ||
|
||
SAML 2.0 Login Success as admin | ||
<form class='form' method="POST"> | ||
username<input name="username"> | ||
password<input name="password"> | ||
<button type='button' id='submit'>submit</button> | ||
</form> | ||
<script src="https://code.jquery.com/jquery-latest.js"></script> | ||
<script type="text/javascript"> | ||
const oneid_base_url = 'http://192.168.31.62:8000' | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const SAMLRequest = urlParams.get('SAMLRequest'); | ||
let next = oneid_base_url + '/saml/login/process/'+'?SAMLRequest='+SAMLRequest; | ||
|
||
$('#submit').click(function(){ | ||
const username = $('input[name=username]').val(); | ||
const password = $('input[name=password]').val(); | ||
$.ajax({ | ||
method: 'POST', | ||
url: '{{token_url}}', | ||
data: {'username': username, 'password': password}, | ||
success: function(){ | ||
window.location.href = next; | ||
} | ||
}) | ||
return false; | ||
}) | ||
</script> |
Oops, something went wrong.