我们有一个ASP.Net MVC,并且一直在使用OpenIdConnect身份验证和Azure AD作为授权。身份验证成功后,我们将“ AuthenticationTicket”有效期设置为8小时(下面我将其设置为15分钟进行测试)。这8小时是固定的,这意味着即使用户在应用程序上执行活动也不会滑动。
但是理想情况下,我们希望随着用户对系统的活跃而使到期日滑动。
尝试将“ SlidingExpiration”设置为True,即使这样做没有帮助。有关此主题的文档未作详细介绍。
那么,我们如何使用OpenIdConnect身份验证实现滑动到期?
以下是我们的启动代码。
namespace TestApp
{
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
CookieManager = new SystemWebCookieManager(),
SlidingExpiration = true,
});
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = Authority,
PostLogoutRedirectUri = postLogoutRedirectUri,
Notifications = new OpenIdConnectAuthenticationNotifications()
{
//
// If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
//
AuthorizationCodeReceived = …Run Code Online (Sandbox Code Playgroud) c# authentication asp.net-mvc azure-active-directory openid-connect
我们正在构建一个编辑器,我们希望使用 TimyMCE 和 React。我们有一些场景,在事件中我们必须向编辑器添加基于模板的内容。我计划将模板设计为 React 组件。
那么,使用 TinyMCE 和 React,如何将 React 组件添加到 TinyMCE 编辑器。
export class AppEditor extends React.Component<iEditorProps, iEditorState> {
innerEditor: React.RefObject<Editor>;
constructor(props: iEditorProps) {
super(props);
this.state = {
content: ''
};
this.innerEditor = React.createRef();
}
handleChange = (content) => {
this.setState({ content });
}
handleAddContent = (e) => {
this.setState(prevState => {
return { content: prevState.content + <TemplateComp>Added Content</TemplateComp> }
});
}
render() {
return (
<div>
<Editor ref={this.innerEditor} inline onEditorChange={this.handleChange} value={this.state.content} />
</div>);
}
}
Run Code Online (Sandbox Code Playgroud)
在上面“ handleAddContent …