Add support for edu.lublin.eu

This commit is contained in:
Mikołaj Pich 2019-10-27 11:29:17 +01:00
parent f0f7efed4e
commit 6873c007a3
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
5 changed files with 58 additions and 7 deletions

View file

@ -107,13 +107,15 @@ class Api {
field = value
}
// TODO: refactor
enum class LoginType {
AUTO,
STANDARD,
ADFS,
ADFSCards,
ADFSLight,
ADFSLightScoped
ADFSLightScoped,
ADFSLightCufs
}
private val appInterceptors: MutableMap<Int, Pair<Interceptor, Boolean>> = mutableMapOf()

View file

@ -4,6 +4,7 @@ import io.github.wulkanowy.api.Api
import io.github.wulkanowy.api.Api.LoginType.ADFS
import io.github.wulkanowy.api.Api.LoginType.ADFSCards
import io.github.wulkanowy.api.Api.LoginType.ADFSLight
import io.github.wulkanowy.api.Api.LoginType.ADFSLightCufs
import io.github.wulkanowy.api.Api.LoginType.ADFSLightScoped
import io.github.wulkanowy.api.Api.LoginType.AUTO
import io.github.wulkanowy.api.Api.LoginType.STANDARD
@ -68,8 +69,7 @@ class LoginHelper(
AUTO -> throw ApiException("You must first specify Api.loginType before logging in")
STANDARD -> sendStandard(it, password)
ADFS -> sendADFS(it, password)
ADFSLight -> sendADFSLightGeneric(it, password, ADFSLight)
ADFSLightScoped -> sendADFSLightGeneric(it, password, ADFSLightScoped)
ADFSLight, ADFSLightScoped, ADFSLightCufs -> sendADFSLightGeneric(it, password, loginType)
ADFSCards -> sendADFSCards(it, password)
}
}
@ -170,6 +170,7 @@ class LoginHelper(
ADFS -> "adfs"
ADFSCards -> "eSzkola"
ADFSLightScoped -> "ADFSLight"
ADFSLightCufs -> "AdfsLight"
else -> "ADFS"
}
@ -180,6 +181,7 @@ class LoginHelper(
return when (type) {
ADFSLight -> "$schema://adfslight.$host/LoginPage.aspx?ReturnUrl=" + encode("/$query")
ADFSLightCufs -> "$schema://logowanie.$host/LoginPage.aspx?ReturnUrl=" + encode("/$query")
ADFSLightScoped -> "$schema://adfslight.$host/$symbol/LoginPage.aspx?ReturnUrl=" + encode("/$symbol/default.aspx$query")
else -> "$schema://adfs.$host/adfs/ls/$query"
}

View file

@ -92,6 +92,7 @@ class RegisterRepository(
it.select(".submit-button, form #SubmitButton").isNotEmpty() -> {
it.selectFirst("form").attr("action").run {
when {
contains("cufs.edu.lublin.eu") -> Api.LoginType.ADFSLightCufs
startsWith("/LoginPage.aspx") -> Api.LoginType.ADFSLight
startsWith("/$symbol/LoginPage.aspx") -> Api.LoginType.ADFSLightScoped
else -> throw ApiException("Nieznany typ dziennika ADFS")

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<title>Logowanie do systemu</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
</head>
<body>
<div class="panel" id="panel">
@ -13,7 +13,7 @@
<div class="box-h">Proszę podać nazwę użytkownika i hasło</div>
<div class="box-p">
<label class="box-line" for="Username">Nazwa użytkownika:</label>
<input class="box-line" id="Username" name="Username" type="text" value=""/>
<input class="box-line" id="Username" name="Username" type="text"/>
<span class="field-validation-valid box-line"></span>
</div>
<div class="box-p">
@ -25,7 +25,8 @@
<button type="submit" class="submit-button box-line">Zaloguj się</button>
</div>
<div>
<a class="box-line box-link" id="aUnlock" href="/AccountManage/UnlockAccountRequest" title="Pierwsze logowanie lub odzyskiwanie hasła">Przywracanie dostępu do konta</a>
<a class="box-line box-link" id="aUnlock" href="/AccountManage/UnlockAccountRequest"
title="Pierwsze logowanie lub odzyskiwanie hasła">Przywracanie dostępu do konta</a>
</div>
<div class="box-p"></div>
@ -37,7 +38,6 @@
</div>
<div class="footer">
<img id="logo" src="/Resources/Rzeszow/footer.png" alt="Stopka strony"/>
<div>&copy; VULCAN sp. z o.o. 2011-2019</div>
<div>CRUSTS 19.9.0.7949</div>
</div>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<title>Logowanie do systemu</title>
</head>
<body>
<div class="panel" id="panel">
<div class="content" id="content">
<form action="/LoginPage.aspx?ReturnUrl=%2f%3fwa%3dwsignin1.0%26wtrealm%3dhttps%253a%252f%252fcufs.edu.lublin.eu%253a443%252fDefault%252fAccount%252fLogOn%26wctx%3drm%253d0%2526id%253dAdfsLight%2526ru%253d%25252f%26wct%3d2019-10-27T09%253a43%253a37Z" method="post">
<div class="label">Zaloguj się</div>
<div class="box" id="box">
<div class="box-h"><label>Proszę podać nazwę użytkownika i hasło</label></div>
<div class="box-p">
<label class="box-line" for="Username">Nazwa użytkownika:</label>
<input class="box-line" id="Username" name="Username" type="text"/>
<span class="field-validation-valid box-line"></span>
</div>
<div class="box-p">
<label class="box-line" for="Password">Hasło:</label>
<input class="box-line" id="Password" name="Password" type="password"/>
<span class="field-validation-valid box-line"></span>
</div>
<div class="box-p">
<a class="box-line box-link" id="aUnlock" href="/AccountManage/UnlockAccountRequest"
title="Pierwsze logowanie lub odzyskiwanie hasła.">Przywracanie dostępu do konta</a>
</div>
<div class="box-p box-right">
<button type="submit" class="submit-button box-line">Zaloguj się</button>
</div>
<div class="box-p"></div>
<div class="box-p box-right box-small" style="display:none">
<a href="#" id="hpReturnHyperlink">Powrót</a>
</div>
</div>
</form>
</div>
<div class="footer">
<div>&copy; VULCAN sp. z o.o. 2011-2019</div>
<div>CRUSTS 19.5.0.7643</div>
</div>
</div>
</body>
</html>