How to create and use an update token for Azure AD

I currently have an Azure site connected to Azure Active Directory, and now users can use it.

However, the access token, which is created as part of the login process, allows users to remain in the system for only one hour. After some research, I found that this problem can be fixed with the introduction of an update token, which will allow the user to log in for longer.

Now the problem is that I cannot find any code on how to actually create and use this update token in my project. The following is the library and code that I use to communicate with Active Directory:

using Microsoft.Owin.Security.ActiveDirectory;

    public class Startup {
        public void Configuration(IAppBuilder app) {
            var config = new HttpConfiguration();
            ConfigureAuth(app);
        }

        private void ConfigureAuth(IAppBuilder app) {
            app.UseWindowsAzureActiveDirectoryBearerAuthentication(
                new WindowsAzureActiveDirectoryBearerAuthenticationOptions {
                    TokenValidationParameters = new TokenValidationParameters {
                        ValidAudience = ConfigurationManager.AppSettings["ida:AudienceUri"]
                    },
                    Tenant = ConfigurationManager.AppSettings["AzureADTenant"]
                });
        }
    }
+4
1

active-directory-dotnet-webapp-webapi-oauth2-useridentity, , TokenDbCache ADAL refreshtokens.

ADAL AuthenticationContext TokenCache, ADAL , .

0

Source: https://habr.com/ru/post/1651263/


All Articles