oauth

AAD B2C-(2) 体验oAuth 保护WEB APP

丶灬走出姿态 提交于 2020-04-13 11:45:51
【今日推荐】:为什么一到面试就懵逼!>>> 本文参照微软如下官方文档,且均使用ASP.NET作为示例代码,主要是演示AAD B2C对WEB APP的保护流程,给大家一个直观的感受,在后续的内容章节中,我们会介绍其他语言如何通过AAD B2C 进行保护。 1.使用 Azure Active Directory B2C 在 Web 应用程序中启用身份验证 https://docs.azure.cn/zh-cn/active-directory-b2c/tutorial-web-app-dotnet?tabs=applications 第一个案例: 主要介绍了一个WEB APP网站,使用ASP.NET开发,该网站使用AAD B2C进行认证授权,用户在浏览器可以直接调用AAD B2C的用户流(也就是使用AAD B2C提供的UI)完成用户注册/登录/修改密码的基本功能,同时,用户登录后,将TOKEN信息返回到这个WEB APP的页面中。 视频介绍: 您可以在B站观看视频: https://www.bilibili.com/video/BV1Cc411h7fM/ 图文介绍: 详细步骤如下: 1. 下载示例代码; 2. 创建AAD B2C 租户; 3. 创建应用程序和密钥; 4.设置用户流; 5.修改web app 的配置文件; 6. 运行web app ,体验用户流; 示例代码: https:

使用Azure Rest API获得Access Token介绍

旧城冷巷雨未停 提交于 2020-04-13 11:02:35
【今日推荐】:为什么一到面试就懵逼!>>> 背景 本文主要介绍如何获取如何获取Azure Rest API的访问token,所采用的是v2.0版本的Microsoft标识平台,关于1.0和2.0的区别可以参考 https://docs.azure.cn/zh-cn/active-directory/azuread-dev/azure-ad-endpoint-comparison 此文档 原理 采用的是OAuth2.0协议的客户端凭据授予的方式,即直接使用client id和secret获取令牌。 步骤 1.新建AAD应用、,导航到Azure门户的AAD界面,选择应用注册,点击新注册。 按照下图填写信息,如果选择多租户是允许访问其他租户的应用,由于我们不涉及到登陆的内容,所以重定向URI无需填写。 2.按照下图的方式,授予AAD应用访问Azure管理服务API权限: 3.接下来授予AAD 应用服务的访问权限,在相关服务的访问控制页面授予AAD应用参与者权限(建议赋予这更订阅的权限,这样可以操作所有应用) 4.收集AAD应用信息,需要租户id,client id,client secret。 进入AAD页面,按照下图方式生成密钥,并且保存密钥,该密钥为client secret 按照下图收集client id和租户id 5.发送token请求,标黄的部分需要填写上个步骤获取的信息:

jenkins安装配置一文搞定

天涯浪子 提交于 2020-04-12 10:26:07
1 .前置准备 安装java 配置JAVA_HOME 安装git 安装maven 安装tomcat 2.安装jenkins 本文安装jenkins采用war的方式,war包下载地址: https://jenkins.io/zh/download/ 只需要将下载的jenkins.war放到tomcat下面,启动tomcat后,访问http://localhost:8080/jenkins 即可 首次进入会让配置插件(跳过),管理员等信息; 3.安装插件提速 mac找到 /Users/didi/.jenkins/updates/default.json window:C:\Program Files (x86)\Jenkins\updates\default.json linux:/var/lib/jenkins/updates/default.json 修改:www.google.com改为www.baidu.com 修改:updates.jenkins-ci.org/download改为mirrors.tuna.tsinghua.edu.cn/jenkins jenkins-> plugin manger > advanced>jenkins地址改为: http://mirror.xmission.com/jenkins/updates/update-center.json

Angular/Express/Passport - Authenticating with Google: No 'Access-Control-Allow-Origin

冷暖自知 提交于 2020-04-11 18:25:48
问题 Context I am building a stateless application using Angular, Express & PassportJS and want to authenticate users using their Google account. After authenticating a user, my goal is to use JWT tokens to be able to have a stateless application. Angular 2 side Upon clicking the Google sign in button, the following code gets executed in my service: login() { return this.http.get('http://localhost:3000/api/auth/google'); } Express side On express, the following gets executed: // This gets executed

Python: Downloading captions from YouTube

倾然丶 夕夏残阳落幕 提交于 2020-04-10 06:50:08
问题 Hello I tried to download captions from a YouTube video with YouTube data API. I customized the example code produced by YouTube. #!/usr/bin/python # Usage example: # python captions.py --videoid='<video_id>' --name='<name>' --file='<file>' --language='<language>' --action='action' import httplib2 import os import sys from apiclient.discovery import build_from_document from apiclient.errors import HttpError from oauth2client.client import flow_from_clientsecrets from oauth2client.file import

.NET Core跨平台微服务学习资源

独自空忆成欢 提交于 2020-04-09 20:05:38
原文: .NET Core跨平台微服务学习资源 一、Asp.net Core基础 微软英文官网:https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-2.1 .NET Core:http://www.dot.net 微软中文官网:https://docs.microsoft.com/zh-cn/aspnet/core/getting-started/?view=aspnetcore-2.1&tabs=windows GitHub:https://github.com/aspnet 用ASP.NET内核和Azure构建现代Web应用程序:https://docs.microsoft.com/en-us/dotnet/standard/modern-web-apps-azure-architecture/ 博客园翻译文档:https://www.cnblogs.com/dotNETCoreSG/p/aspnetcore-index.html MSDN:https://blogs.msdn.microsoft.com/ .NET Core开源峰会:https://github.com/dncto/dnc https://dotnet.github.io/ Artech:https://dotnet.github.io

使用IdentityServer4实现一个简单的Oauth2客户端模式授权

南笙酒味 提交于 2020-04-09 00:54:11
1、首先新建一个webAPI项目做为IdentityServer的服务端,提供生成Token的服务,首先修改Startup.cs文件,如下图: 2、增加一个Config.cs文件,以便于提供资源和认证设置,如下图: 3、在Startup.cs文件中配置做初始化: 4、好了,我们把网站启动,然后我们访问http://localhost:5000/.well-known/openid-configuration(http://localhost:5000是我的程序启动地址,可以在Program.cs文件中自己配置。.well-known/openid-configuration是程序的默认配置地址)然后返回如下内容,表明我们服务端已经没有什么问题了。 5、然后我们再单独创建一个Webapi项目来实现调用IdentityServer端获取token实现资源的正常访问.首先设置启动地址: 6、设置API控制器授权特性: 7、设置启动配置选项: 8.我们先在Postman中用一个错误的token去访问,结果提示未授权。 9、通过访问IdentityServer提供的endpoint(步骤4图中有标记)地址来获取token,如下图: 10.通过获取的token,去访问被限制的资源(即步骤6图中标识的位置),返回成功,即访问成功: 附上通过第三方程序来调用token

Python 库大全 --收集

廉价感情. 提交于 2020-04-08 15:02:33
库名称简介 Chardet字符编码探测器,可以自动检测文本、网页、xml的编码。 colorama主要用来给文本添加各种颜色,并且非常简单易用。 Prettytable主要用于在终端或浏览器端构建格式化的输出。 difflib,[Python]标准库,计算文本差异 Levenshtein,快速计算字符串相似度。 fuzzywuzzy,字符串模糊匹配。 esmre,正则表达式的加速器。 shortuuid,一组简洁URL/UUID函数库。 ftfy,Unicode文本工具7 unidecode,ascii和Unicode文本转换函数。 xpinyin,将汉字转换为拼音的函数库 pangu.py,调整对中日韩文字当中的字母、数字间距。 pyfiglet,Python写的figlet程序,使用字符组成ASCII艺术图片 uniout,提取字符串中可读写的字符 awesome slugify,一个Python slugify库,用于处理Unicode。 python-slugify,转换Unicode为ASCII内码的slugify函数库。 unicode-slugify,生成unicode内码,Django的依赖包。 ply,Python版的lex和yacc的解析工具 phonenumbers,解析电话号码,格式,存储和验证的国际电话号码。 python-user-agents

Return error on invalid or expired token

蹲街弑〆低调 提交于 2020-04-08 09:13:13
问题 I'm trying to implement OAuth Bearer Authentication with Owin. When an invalid or expired token is passed, the default implementation is to log this as a warning and just don't set an Identity. I however would like to reject the whole request with an error in this case. But how would I do this? After digging through the code I found out that in OAuthBearerAuthenticationHandler it will parse the token using a fallback mechanism when the provided AuthenticationTokenProvider did not parse any

Return error on invalid or expired token

旧街凉风 提交于 2020-04-08 09:11:16
问题 I'm trying to implement OAuth Bearer Authentication with Owin. When an invalid or expired token is passed, the default implementation is to log this as a warning and just don't set an Identity. I however would like to reject the whole request with an error in this case. But how would I do this? After digging through the code I found out that in OAuthBearerAuthenticationHandler it will parse the token using a fallback mechanism when the provided AuthenticationTokenProvider did not parse any