在 ASP.NET MVC 应用程序中,我正在尝试针对外部 OIDC 服务实施身份验证。对于我的测试,我使用IdentityServer3 ( https://identityserver.github.io/Documentation/ ) 和公共 OIDC 演示服务器:https ://mitreid.org/
我从 GitHub 克隆了这个示例:https : //github.com/IdentityServer/IdentityServer3.Samples/tree/master/source/MVC%20Authentication
然后添加以下代码将公共 OIDC 服务器注册为外部登录提供程序:
private void ConfigureIdentityProviders(IAppBuilder app, string signInAsType)
{
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "<AuthTypeName>",
Authority = "https://mitreid.org/",
Caption = "MIT Test Server",
ClientId = "<Client Id>",
ClientSecret = "<Client Secret>",
RedirectUri = "https://localhost:44319/", //NOT SURE WHAT TO PUT HERE
ResponseType = "code",
Scope = "openid email profile",
SignInAsAuthenticationType = signInAsType
});
}
Run Code Online (Sandbox Code Playgroud)
代码有效,我可以选择通过外部 OIDC 服务器登录。浏览器重定向到外部服务器登录页面,当输入登录名和密码时,将显示同意页面。但是,在浏览器导航回 …
参考 Keycloak 的帐户链接文档,我需要从访问令牌中获取用户会话 id和客户端会话 id 。
然而,我只发现他们在令牌上调用的东西显然与查看他们的javascript 适配器源代码session_state相同。sessionId
我认为这是他们指的用户会话ID ?如果是这样,我在哪里可以找到这个所谓的客户端会话 id?
我正在开发一个应用程序,该应用程序允许用户使用他们的 google 帐户登录,然后使用该登录名获取 Cognito 联合身份。
我无法获得使用 Cognito 进行身份验证所需的正确令牌。我不断收到错误com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Invalid login token. Not a valid OpenId Connect identity token.
这是我的代码:
Runnable runnable = new Runnable() {
@Override
public void run() {
CognitoSyncClientManager.init(getActivity().getApplicationContext());
String token = null;
try {
token = GoogleAuthUtil.getToken(getActivity().getApplicationContext(), signInAccount.getAccount(), "oauth2:openid");
}catch (Exception e){
Log.d("login exception", e.toString());
}
Map<String, String> logins = new HashMap<String, String>();
logins.put("accounts.google.com", token);
CognitoSyncClientManager.addLogins("accounts.google.com", token);
Log.d("login", "Created User token " + token);
Log.d("login", "Cached UserID: "+CognitoSyncClientManager.credentialsProvider.getCachedIdentityId());
Log.d("login", "UserID: " + CognitoSyncClientManager.credentialsProvider.getIdentityId());
Toast.makeText(getActivity().getApplicationContext(), "Created user: …Run Code Online (Sandbox Code Playgroud)openid google-openid openid-connect amazon-cognito aws-cognito
我不太明白为什么 oauth2 用于授权而 OpenID Connect 用于身份验证目的。
授权服务器 在成功 验证资源所有者并获得授权后,服务器向客户端颁发访问令牌。
另一方面,根据授权代码流 RFC代理或依赖方被重定向到某种身份验证页面,以便能够对用户进行身份验证,不是吗?
此外,我一直读到 OpenID Connect 构建在 Oauth2 之上,以便为 Oauth2 提供身份验证机制。这样对吗?
我有带有开放 ID 连接身份验证的 asp.net core 2.1 应用程序:
services.AddAuthentication(...)
.AddCookie(...)
.AddOpenIdConnect(...);
Run Code Online (Sandbox Code Playgroud)
当未经身份验证的用户访问 url: 时/path?somequery#somehashfragment,它会被重定向到身份验证提供商的登录页面,然后返回到/path?somequery,但哈希片段会被删除。
我最近从头开始实现一个新应用程序,所以我创建了一个新应用程序,它有自己的数据库,我使用 Identity Server 4 和 ASP.NET Identity,它有一个单独的持久性数据库,我将它命名为 Identity_Server。
计划是在不久的将来,我将开始开发另一个应用程序,这些应用程序将成为中央身份服务提供商(身份服务器 4)中的客户端。
我现在面临的问题是,在我正在开发的应用程序中,我有像 CreatedById 和 LastUpdatedById 这样的审计列,它们将捕获用户 ID。我将有一个日志表,我将在其中存储用户 ID 作为外键。存储用户 ID 不是问题,因为我可以在用户登录应用程序后捕获它,但问题是在 UI 中我想呈现更有意义的声明,如用户名或全名。
我如何在应用程序实体和身份服务器用户实体之间建立关系,其中两者都位于单独的数据库上下文和单独的物理数据库中。
我是否应该更改架构并将我的所有应用程序实体保存在与身份服务器相同的数据库中?
我们正在启动一个带有去中心化身份 (DID) 的 POC(概念证明),并获得了一份讨论要使用的身份验证方法的文档:
OIDC 云代理与 SIOP 边缘代理。
不明白那两个东西是什么?以及使用一种或另一种的优点或缺点是什么。
我知道 OpenId Connect 但不知道这两个,任何解释或阅读链接都将不胜感激。
谢谢
openid-connect hyperledger-indy decentralized-identity decentralized-identifiers
我正在尝试设置一个 ASP.net Core 3 MVC 应用程序,该应用程序使用 OIDC 连接到我公司的 SSO 门户 (OpenAM)。
我使用 Visual Studio 2019 项目生成器创建了一个没有身份验证的基本应用程序,然后按照http://docs.identityserver.io/en/latest/quickstarts/2_interactive_aspnetcore.html#creating-an 中的步骤添加了 OIDC 客户端功能-mvc 客户端。只需对 Startup 类进行最少的更改,登录就可以很好地工作:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
// Setup Identity Server client
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "https://mycompany.com/ssoservice/oauth2";
options.RequireHttpsMetadata = false;
options.ClientId = "openIdClient";
options.ClientSecret = "secret";
options.ResponseType = "code";
options.ProtocolValidator.RequireNonce = false;
options.SaveTokens = true;
});
}
// This …Run Code Online (Sandbox Code Playgroud) 我正在将 ASP.NET Core MVC 3.0 应用程序集成到 Azure AD 以进行身份验证和授权,一切正常,但是当我尝试注销时,一旦login.microsoftonline.com我注销,它就会重定向到我的应用程序,然后出现以下错误:
No webpage was found for the web address:
https://localhost:5002/Account/SignOut?page=%2FAccount%2FSignedOut
Run Code Online (Sandbox Code Playgroud)
我用来调用注销过程的路径是/AzureAD/Account/SignOut.
内容appsettings.json:
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "[OMITTED]",
"TenantId": "[OMITTED]",
"ClientId": "[OMITTED]",
"CallbackPath": "/signin-oidc"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Run Code Online (Sandbox Code Playgroud)
这些是我的Startup.cs课堂内容:
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "[OMITTED]",
"TenantId": "[OMITTED]",
"ClientId": "[OMITTED]",
"CallbackPath": "/signin-oidc"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning", …Run Code Online (Sandbox Code Playgroud) 我有两个 Web 应用程序(应用程序 A 和应用程序 B),并且想将其中一个(A)用作另一个(B)中的 iframe。我在当前的 Web 应用程序 (B) 中有一个令牌,它在 iframe (A) 中也有效。iframe Web 应用程序 (A) 使用 OIDC js 身份验证和 angularjs,现在如何将令牌从 B 发送到 A 并使用它?
在我的 A 应用程序中,我有这个:
var config = {
authority: '...my auth server ...',
client_id: '...'
...
}
mgr = new OidcTokenManager(config);
if (window.location.hash && window.location.hash.indexOf('id_token') > -1) {
mgr.processTokenCallbackAsync().then(function () {
//checkSessionState();
}, function (error) {
});
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但是当我使用 A 作为 iframe 时,mgr没有启动正确的和一些access_token未定义的属性!
openid-connect ×10
asp.net ×2
c# ×2
javascript ×2
asp.net-core ×1
asp.net-mvc ×1
aws-cognito ×1
keycloak ×1
oauth ×1
oauth-2.0 ×1
openid ×1
url ×1