You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
889 B
29 lines
889 B
using EPAServeur.BDAccess;
|
|
using Microsoft.AspNetCore.Http;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EPAServeur.Commun
|
|
{
|
|
public class KeycloakAuthentificator
|
|
{
|
|
private static readonly string host = "http://www.epa.apside.com/auth/realms/master/protocol/openid-connect/userinfo";
|
|
public static bool IsvalidToken(string token)
|
|
{
|
|
List<KeyValuePair<string, string>> param = new List<KeyValuePair<string, string>>();
|
|
param.Add(new KeyValuePair<string, string>("access_token", token));
|
|
|
|
if (APIAccess.requestPostAPI<KeyValuePair<string, string>>(host, param) == null)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|