首页 \ 问答 \ 如何验证由Thinktecture身份服务器发布的JWT令牌?(How to Validate JWT Token issued by Thinktecture identity server?)

如何验证由Thinktecture身份服务器发布的JWT令牌?(How to Validate JWT Token issued by Thinktecture identity server?)

有没有办法在OAuth客户端从身份服务器获取JWT令牌时是否可以?

我担心当用户获取access_token并尝试使用base64解码它时,用户可以修改令牌字符串。

我的方案是:我有两个Web门户A和B,他们都集成了Thinktecture身份服务器。 用户A只能通过“角色:portalA”声明访问门户A,但如果用户A尝试登录门户A并获取access_token,则用户A将“role:portalB”添加到access_token中,然后用再次base64。 那么修改过的access_token传递给门户B,我担心用户A可以访问门户B,所以我必须再次检查access_token到身份服务器。 是否有任何方法来验证这个access_token? 或者这种情况不会发生?


Is there any way that when the OAuth client get the JWT token from identity server is OK or not?

I afraid the when user get the access_token and try to use base64 to decode it then users can modify the token string .

My scenario is : I have two web portal A and B both of them integrated the Thinktecture identity server. User A just can access portal A with "role:portalA" claim but couldn't access portal B if user A try to login portal A and get the access_token then user A add the "role:portalB" into the the access_token then encode with base64 again. then the modified access_token pass to the Portal B, I afraid that user A could access portal B. so I have to check the access_token to Identity server again. is that any way to validate this access_token ? or this situation will not be happened?


原文:https://stackoverflow.com/questions/23291730
更新时间:2022-03-11 10:03

最满意答案

这应该这样做:

$date = is_array($arr['Date']) ? $arr['Date'][0] : $arr['Date'];

This should do it:

$date = is_array($arr['Date']) ? $arr['Date'][0] : $arr['Date'];

相关问答

更多
  • 只需删除$id["1"]周围的撇号: $output[$id["1"]] 否则, '$id["1"]'被字面上视为字符串索引。 Just remove the apostrophes around $id["1"]: $output[$id["1"]] Otherwise, the '$id["1"]' is treated literally as a string index.
  • 不是推荐的做事方式,而是: $arr = array(); for($i=0;$i<5;$i++) { $varName = 'number_'.$i; $arr[] = $$varName; } Not a recomended way of doing things but: $arr = array(); for($i=0;$i<5;$i++) { $varName = 'number_'.$i; $arr[] = $$varName; }
  • 使用sprintf ,使用%s作为占位符: $game_descr = [ 1 => 'some text1 (%s) some text', // ... ]; $posts = $wpdb->get_results("SELECT ID, post_title, post_content FROM wp_posts WHERE post_status = 'publish'"); foreach ($posts as $p) { $index = mt_rand(1, count($g ...
  • echo is_array($ variable); http://us3.php.net/is_array echo is_array($variable); http://us3.php.net/is_array
  • 这应该这样做: $date = is_array($arr['Date']) ? $arr['Date'][0] : $arr['Date']; This should do it: $date = is_array($arr['Date']) ? $arr['Date'][0] : $arr['Date'];
  • 正如评论中所述: $x = utf8_encode(urldecode($_GET['x'])); 而且你应该/可以使用in_array() if (in_array($x, $y)) { echo "Found!"; } As posted in the comments: $x = utf8_encode(urldecode($_GET['x'])); And also you should/could use in_array() if (in_array($x, $y)) { echo "Fo ...
  • 您可以将包含的文件看起来像这样。 'bar']; 然后使用array_push($all, $myVars); 要么 如果您包含的文件看起来像这样。 'bar']; 然后你可以使用array_push($all, include($getVariable . "Array.php")); 无论哪种方式, $all将== [['foo' => 'bar']] You can either have you ...
  • 要使数据库得到正确的规范化,您应该以不会将数组存储在数据库中的方式来构建表,而是每个用户都是表中的一行。 然而,要回答你的问题,你需要使用explode()函数。 //$row['usersBought'] = "Darren,Adam,Coral"; <- Example $user = "Darren"; $usersBought = $row['usersBought']; $userArray = explode(",", $usersBought); if (in_array($user, $u ...
  • $opts = array( 'page'=>"/subfolder/{$my_var}.php" ); $opts = array( 'page'=>"/subfolder/{$my_var}.php" );
  • 如果$var是标量,则记录两行都是相同的: 对于任何类型:整数,浮点数,字符串,布尔值和资源,将值转换为数组会生成一个数组,其中包含索引为零的单个元素以及已转换的标量值。 换句话说, (array)$ scalarValue与数组($ scalarValue)完全相同 。 http://www.php.net/manual/en/language.types.array.php#language.types.array.casting If $var is a scalar, it's documented ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)