//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public FabOauthAccess AddAccess(IOperationContext pOpCtx, CreateOauthAccessOperation pCreateOp, long pMemberId, bool pClientMode = false) { ClearOldTokens(pOpCtx, pMemberId); const int expireSec = 3600; bool needsActiveMem = (pOpCtx.Auth.ActiveMemberId == null); CreateFabOauthAccess coa = new CreateFabOauthAccess(); coa.Token = pOpCtx.Code32; coa.Refresh = (pClientMode ? null : pOpCtx.Code32); coa.Expires = pOpCtx.UtcNow.AddSeconds(expireSec).Ticks; coa.AuthenticatesMemberId = pMemberId; if (needsActiveMem) { pOpCtx.Auth.SetFabricActiveMember(); } OauthAccess result = pCreateOp.Execute(pOpCtx, new CreateOperationBuilder(), new CreateOperationTasks(), coa); if (needsActiveMem) { pOpCtx.Auth.RemoveFabricActiveMember(); } return(new FabOauthAccess { AccessToken = result.Token, RefreshToken = result.Refresh, ExpiresIn = expireSec, TokenType = "bearer" }); }
/*--------------------------------------------------------------------------------------------*/ protected override OauthAccess ExecuteOperation() { var op = new CreateOauthAccessOperation(); return(op.Execute(OpCtx, Build, Tasks, vCreateOauthAccess)); }