modification messageService
This commit is contained in:
parent
819d266601
commit
6444df567b
4 changed files with 56 additions and 30 deletions
|
|
@ -1,14 +1,14 @@
|
|||
-----BEGIN PUBLIC KEY-----
|
||||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyTaN1skc89wdcz8SLY9c
|
||||
lkcARENbO40DncmcUZwQEq+EYR9BzUhjIzKJ6JetU+qGt4SJQkPAczQbw8+LaF6P
|
||||
NT0QTF6E6BUgTZg1p98E/208AiFDnoqEjmlLdQN7ekttJXGDrVOTds9WMbn8lVpa
|
||||
4EpVc+8CPDmrSTIC2YVSZmmektmFTSUA6411+5FGlq5oUdyKkToWYdn/ViJbYst8
|
||||
N48E2Vuh1ghY5t7oPWGzPibMc/6A+uDAF7+VVD8x5UydMZ9id+RxC7lhtDDvZeRM
|
||||
BllHcnWfw0UMhVk8PC6/BenJ4I8HiOgyl4cypTvlevfbZjSoNJ4g/u/lDKpdqbBg
|
||||
T76OksaYqvwvTrcvPdgF1f8l/7M9ESYZTMpxvqK6YvYC/MG2355fmZ1SeuqKfDt8
|
||||
rQXfXzesGSNmFNkm8mORHYiXBqyuNAwnSqRtP8qfoB4yXZ2W1HjUf24TvkvMrqwT
|
||||
7PFg55c/f4LVdPjx52z30QzBJmcyVZgzXNOCG1KafwBibhriQmhdfiWogs824mwI
|
||||
9w0vG2pPqSHRAa6N1y9JHSP1rIfu1jzRNFWTUuqyKgLYBE47HqxxJ21BwBryTVUz
|
||||
8Ei+o05lJFkQX2/ISFYP2RunfUBccqmv0nEcGr+RSLTeqz5+WUTWs8tQxUItf2p6
|
||||
9Y30htlmCJlSnHn2JlaJWQUCAwEAAQ==
|
||||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtW31Xj62sjbJVBxnn0G2
|
||||
Habc22q7/pFIBdfn8+OsajdNVnmtfRNOsSXZP8sNhXt1QLPSgxZ/wogG0fLXIX2+
|
||||
ewzPgqrwTnr+quJ1DZ6RqOY3G1PGOibgk25aHkIXJ/gTPk1yTT6pjUmKiaGKM8pt
|
||||
M2wGwugCdEH5Wndgby8Jej30v/PPzyPxTSXrIWDeaSMX+jQyFZTGgEdgL7JvjkTj
|
||||
qLtfWKIAcEeO4PzOlRXVvbzBoYphBiZqkbzEeuOjSLPxgy4cQdbqVMlJ/lZt0SBO
|
||||
MLiIUBTufLcJS3ApesiZWWfUCq+pFFdhEABc9qrtVumzhmzWAv2rKVrHRXbguxc/
|
||||
eHKlRjAE4qmnNnTP2fsAuQIPkXVHOPWdXM1IBwnhXVB+XhxEHSANx/2oeKS6fO/e
|
||||
1oNJCiVkHin9gC8vkU9seEN73lNKZ5wPXMqTYUGA65dCY+8li+n/1pveJOJozFk7
|
||||
amkmOAPTi44lBJmxRm88XBHC3TXz6tFqX3phMqFDcQs2D9s3/2UylK0dSH5MSLnb
|
||||
9x24/ykO4RlPRVCC90vwlxzbnb0rfQVlT4dKcE6OIyXw3UsqIqFnXWmm+hnGu4QH
|
||||
Ysr+i1VIhPOs9YdZwlqhzcPTuNcdxmxy9ZfZ8KlLIWbAMbSH+obwm4w+HYTZjspe
|
||||
2MwrKGgzpl4YW7ct/ViqeQMCAwEAAQ==
|
||||
-----END PUBLIC KEY-----
|
||||
|
|
|
|||
2
app-backend/jwtRS256.sh
Normal file → Executable file
2
app-backend/jwtRS256.sh
Normal file → Executable file
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key -q -N ""
|
||||
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
|
||||
rm .env
|
||||
#rm .env
|
||||
echo "JWTRS256_PRIVATE_KEY='`cat ./jwtRS256.key | base64 -w 0`'" >> .env
|
||||
echo "JWTRS256_PUBLIC_KEY='`cat ./jwtRS256.key.pub | base64 -w 0`'" >> .env
|
||||
source .env
|
||||
|
|
|
|||
|
|
@ -42,8 +42,25 @@ export class PageLoginComponent implements OnInit
|
|||
hashPass: this.hashage(this.password)
|
||||
};
|
||||
this.messageService
|
||||
.sendMessage('user/auth', data)
|
||||
.subscribe( retour => this.maCallback(retour))
|
||||
.post('user/auth', data)
|
||||
.subscribe( retour => this.onSeConnecterCallback(retour));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onSeConnecterCallback(retour): void
|
||||
{
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== 200)
|
||||
{
|
||||
console.log("noooo !");
|
||||
//this.errorMessage = retour.error.data.reason;
|
||||
//this.hasError = true;
|
||||
}
|
||||
else {
|
||||
console.log("yeeess !");
|
||||
//this.router.navigateByUrl( '/search' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -63,19 +80,6 @@ export class PageLoginComponent implements OnInit
|
|||
}
|
||||
|
||||
|
||||
maCallback(retour): void
|
||||
{
|
||||
console.log(retour.data)
|
||||
if(retour.status !== 200) {
|
||||
this.errorMessage = retour.error.data.reason;
|
||||
this.hasError = true;
|
||||
}
|
||||
else {
|
||||
//this.router.navigateByUrl( '/search' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkError(): void
|
||||
{
|
||||
if(this.email === "") {
|
||||
|
|
|
|||
|
|
@ -3,16 +3,38 @@ import {HttpClient} from "@angular/common/http";
|
|||
import {environment} from "../../../../environments/environment";
|
||||
import {Observable} from "rxjs";
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MessageService
|
||||
{
|
||||
|
||||
constructor( private http: HttpClient ) { }
|
||||
|
||||
sendMessage( url, data ): Observable<any>
|
||||
post(url: string, data: any): Observable<any>
|
||||
{
|
||||
const urlComplete = environment.debutUrl + url ;
|
||||
return this.http.post<any>(urlComplete, data, {withCredentials: true});
|
||||
}
|
||||
|
||||
get(url: string, data: any): Observable<any>
|
||||
{
|
||||
const urlComplete = environment.debutUrl + url ;
|
||||
return this.http.get<any>(urlComplete, data);
|
||||
}
|
||||
|
||||
put(url: string, data: any): Observable<any>
|
||||
{
|
||||
const urlComplete = environment.debutUrl + url ;
|
||||
return this.http.put<any>(urlComplete, data, {withCredentials: true});
|
||||
}
|
||||
|
||||
delete(url: string, data: any): Observable<any>
|
||||
{
|
||||
const urlComplete = environment.debutUrl + url ;
|
||||
return this.http.delete<any>(urlComplete, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue