|
GRUPOS DE DISCUSSÃO PROFISSIONAL WINDEV, WEBDEV e WINDEV Mobile |
| | | | | |
Iniciado por BOLLER, mar., 05 2020 10:06 PM - 4 respostas |
| |
| | | |
|
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em março, 05 2020 - 10:06 PM |
Exemplo
Procedure _VérifieAuthentification(LOCAL bufDonnées is Buffer,LOCAL sUtilisateur is string,LOCAL sSignature is string)
sUtilisateurRecu is string = sUtilisateur
biOS is boolean
IF HReadSeekFirst(Utilisateur,Login,sUtilisateur) = False THEN RESULT "" END
sEmplacementClePrivee is string = fDataDir() + [fSep] + GetGUID(guidRough) + ".pem" IF fSaveBuffer(sEmplacementClePrivee ,Utilisateur.ClePrivee) = False THEN RESULT "Impossible de sauver la clé" END
sDecrypte is string = DecryptAsymmetric(HexaToBuffer(bufDonnées), sEmplacementClePrivee , "", cryptPaddingPKCS1)
IF sDecrypte ~~ "" THEN bufOK is Buffer FOR i = 1 _TO_ Length(bufDonnées) IF Modulo(i,4) IN (0,3) THEN ELSE bufOK += bufDonnées[[i]] END END bufDonnées = bufOK sDecrypte = DecryptAsymmetric(HexaToBuffer(bufDonnées), sEmplacementClePrivee , "", cryptPaddingPKCS1) sEncodeUtilisateurOK is string FOR i = 1 _TO_ Length(sUtilisateur) sEncodeUtilisateurOK += sUtilisateur[[i]] + sDecrypte[[2]] END sUtilisateur = sEncodeUtilisateurOK biOS = True END
fDelete(sEmplacementClePrivee )
sSignatureCalculée is string = sDecrypte + sUtilisateur sSignatureCalculée = BufferToHexa(HashString(HA_MD5_128,sSignatureCalculée))
IF biOS THEN sDecrypteOK is string FOR i = 1 _TO_ Length(sDecrypte) IF Modulo(i,2) = 1 THEN sDecrypteOK += sDecrypte[[i]] END END sDecrypte = sDecrypteOK END
IF sSignatureCalculée = sSignature THEN RESULT "Utilisateur : " + sUtilisateurRecu + CR + "Données : " + sDecrypte END
RESULT ""
Procedure TestSecurise()
sUtilisateurAVerifier is string = WebserviceReadHTTPHeader("Utilisateur") sSignature is string = WebserviceReadHTTPHeader("Signature") sInformations is string = _VérifieAuthentification(WebserviceParameter(paramBuffer),sUtilisateurAVerifier,sSignature)
IF sInformations = "" THEN RESULT "Échec de l'authentification, aucune action ne sera réalisée." ELSE RESULT "Le message n'a pas été modifié, authentification réussie." + CR + "informations transmises au Webservice : " + CR + sInformations END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em março, 05 2020 - 10:10 PM |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em março, 06 2020 - 12:40 PM |
Usuario is string = WebserviceReadHTTPHeader("User") Senha is string = WebserviceReadHTTPHeader("Password") ... Usa dai o usuario dentro DO codigo lendo da base se bate com os dados informados
OK
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em maio, 20 2020 - 5:09 PM |
ATENÇÃO
Write Header https://help.windev.com/en-US/…
https://help.windev.com/en-US/?1000022788&name=WebserviceWriteHTTPHeader
Read Header https://help.windev.com/en-US/…
https://help.windev.com/en-US/?1000022787&name=WebserviceReadHTTPHeader
A funcao read e a funcao write é ideia igual do ini
simples assim:
o write coloca no teu webservice antes de publicar
e o read quando for consumir o webservice
//----
The read function and the write function is the same idea as the start
that simple:
write puts on your webservice before publishing
and read when consuming webservice
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em julho, 06 2021 - 7:48 PM |
Passando para agradecer o @?Ricardo Cassolato Cliente Pgto? pela ajuda, estava precisando passar um JSON No body da requisição e me ajudou de imediato, meu muito obrigado!
JsonResponse is JSON = "" sJsonBody is string = {"usuario":"[%variavel_usuario%]","senha":"[%variavel_senha%]"} MyRequest is httpRequest MyRequest..URL = "https://192.168.15.250/wsmobileautenticar.rule?sys=CIE" MyRequest..Method = httpPost MyRequest..Timeout = 180s MyRequest..Content = sJsonBody MyResponse is httpResponse = HTTPSend(MyRequest) JsonResponse = MyResponse..Content |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|