public GoogleAuthorizationCodeService(Controller controller, FlowMetadata flowData) { Flow = flowData.Flow; RedirectUri = new Uri($"{controller.Request.Url?.GetLeftPart(UriPartial.Authority)}{flowData.AuthCallback}").ToString(); State = controller.Request.Url?.ToString(); UserId = flowData.GetUserId(controller); }
// protected override FlowMetadata FlowData => throw new NotImplementedException(); public AuthCallbackController() { var dataStore = new DataStore(); var clientID = WebConfigurationManager.AppSettings["GoogleClientID"]; var clientSecret = WebConfigurationManager.AppSettings["GoogleClientSecret"]; flowMetaData = new GoogleAppFlowMetaData(dataStore, clientID, clientSecret); }
/// <summary>Constructs a new authorization code MVC app using the given controller and flow data.</summary> public AuthorizationCodeMvcAppOverride(Controller controller, FlowMetadata flowData) : base( flowData.Flow, ConfigurationManager.AppSettings["RedirectUri"], controller.Request.Url.ToString()) { this.controller = controller; this.flowData = flowData; }
/// <summary>Constructs a new authorization code MVC app using the given controller and flow data.</summary> public CustomAuthorizationCodeMvcApp(Controller controller, FlowMetadata flowData) : base( flowData.Flow, new Uri(controller.Request.Url.GetLeftPart(UriPartial.Authority) + "/CustomController" + flowData.AuthCallback).ToString(), controller.Request.Url.ToString()) { this.controller = controller; this.flowData = flowData; }
public AuthCallbackController() { var dataStore = new DataStore(); var clientID = WebConfigurationManager.AppSettings["GoogleClientID"]; var clientSecret = WebConfigurationManager.AppSettings["GoogleClientSecret"]; flowMetaData = new GoogleAppFlowMetaData(dataStore, clientID, clientSecret); log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); log.Debug("-------------------------------Contrutor AUthCalback"); }
public AuthorizationCodeMvcAppFactory(FlowMetadata flowMetadata, Controller currentController) { FlowMetadata = flowMetadata; CurrentController = currentController; }
public async Task <IActionResult> BuildEditor(string id, string prefix, string prefixesName, string contentTypesName, string targetId, bool flowmetadata, string parentContentType, string partName, string templateContentItemId = "", bool isConfigMode = false) { if (String.IsNullOrWhiteSpace(id)) { return(NotFound()); } var contentItem = await _contentManager.NewAsync(id); if (!String.IsNullOrEmpty(templateContentItemId)) { //get template content item //merge template content to existing new widget content var templateContentItem = await _contentManager.GetAsync(templateContentItemId, VersionOptions.Latest); if (templateContentItem != null) { /*var partActivator = _contentPartFactory.GetTypeActivator("HtmlBodyPart"); * var part = templateContentItem.Get(partActivator.Type, "HtmlBodyPart") as ContentPart; * contentItem.Apply(part);*/ var newContentItemClone = await _contentManager.NewAsync(id); newContentItemClone.Content.HtmlBodyPart = templateContentItem.Content.HtmlBodyPart; contentItem.Apply(newContentItemClone); } } _httpContextAccessor.HttpContext.Items["IsWidgetEditorInConfigMode"] = isConfigMode; // Does this editor need the flow metadata editor? string cardCollectionType = null; int colSize = 12; IEnumerable <ContentTypeDefinition> containedContentTypes = null; if (flowmetadata) { var metadata = new FlowMetadata(); contentItem.Weld(metadata); colSize = (int)Math.Round((double)metadata.Size / 100.0 * 12); containedContentTypes = GetContainedContentTypes(parentContentType, partName); cardCollectionType = nameof(FlowPart); } else { cardCollectionType = nameof(BagPart); } //Create a Card Shape dynamic contentCard = await _shapeFactory.New.ContentCard( //Updater is the controller for AJAX Requests Updater : _updateModelAccessor.ModelUpdater, TabIndex : -1, //Shape Specific CollectionShapeType : cardCollectionType, ContentItem : contentItem, BuildEditor : true, ParentContentType : parentContentType, CollectionPartName : partName, ContainedContentTypes : containedContentTypes, //Card Specific Properties TargetId : targetId, Inline : true, CanMove : true, CanDelete : true, //Input hidden //Prefixes HtmlFieldPrefix : prefix, PrefixesId : prefixesName.Replace('.', '_'), PrefixesName : prefixesName, //ContentTypes ContentTypesId : contentTypesName.Replace('.', '_'), ContentTypesName : contentTypesName ); //Only Add ColumnSize Property if Part has FlowMetadata if (flowmetadata) { contentCard.ColumnSize = colSize; } var model = new BuildEditorViewModel { EditorShape = contentCard }; return(View("Display", model)); }
public AuthCallbackController(FlowMetadata flow) { flowMetaData = flow; }
public async Task <IActionResult> BuildEditor(string id, string prefix, string prefixesName, string contentTypesName, string contentItemsName, string targetId, bool flowmetadata, string parentContentType, string partName) { if (String.IsNullOrWhiteSpace(id)) { return(NotFound()); } var contentItem = await _contentManager.NewAsync(id); // Does this editor need the flow metadata editor? string cardCollectionType = null; int colSize = 12; IEnumerable <ContentTypeDefinition> containedContentTypes = null; if (flowmetadata) { var metadata = new FlowMetadata(); contentItem.Weld(metadata); colSize = (int)Math.Round((double)metadata.Size / 100.0 * 12); containedContentTypes = GetContainedContentTypes(parentContentType, partName); cardCollectionType = nameof(FlowPart); } else { cardCollectionType = nameof(BagPart); } //Create a Card Shape dynamic contentCard = await _shapeFactory.New.ContentCard( //Updater is the controller for AJAX Requests Updater : _updateModelAccessor.ModelUpdater, //Shape Specific CollectionShapeType : cardCollectionType, ContentItem : contentItem, BuildEditor : true, ParentContentType : parentContentType, CollectionPartName : partName, ContainedContentTypes : containedContentTypes, //Card Specific Properties TargetId : targetId, Inline : true, CanMove : true, CanDelete : true, //Input hidden //Prefixes PrefixValue : prefix, PrefixesId : prefixesName.Replace('.', '_'), PrefixesName : prefixesName, //ContentTypes ContentTypesId : contentTypesName.Replace('.', '_'), ContentTypesName : contentTypesName, //ContentItems ContentItemsId : contentItemsName.Replace('.', '_'), ContentItemsName : contentItemsName ); //Only Add ColumnSize Property if Part has FlowMetadata if (flowmetadata) { contentCard.ColumnSize = colSize; } var model = new BuildEditorViewModel { EditorShape = contentCard }; return(View("Display", model)); }