Skip to content

Commit

Permalink
[KFI] Merge changes from release branch before release 7.0.0 stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tusmester committed Dec 2, 2017
1 parent aa31792 commit ef0217a
Show file tree
Hide file tree
Showing 167 changed files with 4,046 additions and 1,463 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The first Open Source Enterprise Content Management platform for .NET!
[![Join the chat at https://gitter.im/SenseNet/sensenet](https://badges.gitter.im/SenseNet/sensenet.svg)](https://gitter.im/SenseNet/sensenet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

> **sensenet Services 7.0 beta** is out! Jump to the [Getting started](#GettingStarted) section below to start experimenting right away!
> **sensenet Services 7.0 stable** is out! Jump to the [Getting started](#GettingStarted) section below to start experimenting right away!
If you need...
- a **Content Repository** with a powerful query engine (built on [Lucene.Net](https://lucenenet.apache.org)) for storing *millions* of documents,
Expand Down Expand Up @@ -46,7 +46,7 @@ Whether you're a community member or enterprise customer, feel free to visit our
## Getting started
Currently we offer two different versions of sensenet ECM. We recommend version 7.0 for new projects as it is more lightweight and flexible.

### sensenet ECM 7.0 (beta)
### sensenet ECM 7.0
A modern ECM platform that can be integrated into existing or new web applications. We modularized sensenet ECM so that you can install only the parts you need. Take a look at the currently published [core components](/docs/sensenet-components.md)!

There is also a number of other built-in and 3rd party [components and plugins](https://github.com/SenseNet/awesome-sensenet) that are built on this platform either by us or the community.
Expand Down
Binary file modified docs/images/SenseNetTokenAuthentication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/install-sn-from-nuget.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This is why we decided to publish two types of packages for our components:
<a name="InstallPackage"></a>
## Installing sensenet Services

![Sense/Net Services](https://github.com/SenseNet/sn-resources/raw/master/images/sn-components/sn-components_services.png "Sense/Net Services")
![sensenet Services](https://github.com/SenseNet/sn-resources/raw/master/images/sn-components/sn-components_services.png "sensenet Services")

### Create a web project and pull in the package(s)

Expand All @@ -40,15 +40,15 @@ This is why we decided to publish two types of packages for our components:

[![NuGet](https://img.shields.io/nuget/v/SenseNet.Services.Install.svg)](https://www.nuget.org/packages/SenseNet.Services.Install)

> `Install-Package SenseNet.Services.Install -Pre`
> `Install-Package SenseNet.Services.Install`
(this will install the other one too, no need to pull that in manually)

#### In other projects

[![NuGet](https://img.shields.io/nuget/v/SenseNet.Services.svg)](https://www.nuget.org/packages/SenseNet.Services)

> `Install-Package SenseNet.Services -Pre`
> `Install-Package SenseNet.Services`
### Web app changes
> The install process described below is the same that you will see in the _readme.txt_ that appears in *Visual Studio* after adding the install package.
Expand Down
118 changes: 118 additions & 0 deletions docs/oauth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# OAuth in sensenet ECM
[OAuth 2.0](https://oauth.net/2/) is the industry-standard protocol for authorization. In [sensenet ECM](https://github.com/SenseNet/sensenet) we use it as an extension to our [web token authentication](https://community.sensenet.com/docs/web-token-authentication) to let users **authenticate** using well-known services (such as *Google* or *Facebook*).

The benefit is that users are able to sign in to a sensenet ECM application with a single click, **without manual registration**.

## How it works?
When new users come to the site, they will be able to sign in by clicking the Google or Facebook button (or a similar custom experience implemented by the developer). The workflow is the following:

- User signs in to the 3rd party service.
- User authorizes the application with the service (e.g. let the application access basic user data like name and email). This is usually a click of a button in the Google or Facebook popup window.
- The client **receives a token from the service**.
- The client sends the token to the sensenet ECM server, where the appropriate **OAuth provider verifies the token**.
- If the token has been verified, we load or create the corresponding *User* content in the Content Repository. User content items are connected to the 3rd party service by storing the unique user identifier in a provider-specific separate field (e.g. *GoogleUserId*).
- sensenet ECM asssembles a [JWT token](https://community.sensenet.com/docs/web-token-authentication) for the client and consideres the user as correctly signed in.

From that point on the user will be able to use the application as a regular user.

### Configuration
You can specify where new users are created and their content type using the *OAuth* settings content in the usual global *Settings* folder.

```json
{
UserType: "User",
Domain: "Public"
}
```

New users are created under the domain above separated into organizational units named by the provider.

## OAuth providers
A sensenet ECM OAuth provider is a small plugin that is designed to verify a token using a particular service. Out of the box we offer the following OAuth provider for sensenet ECM:

- Google [![NuGet](https://img.shields.io/nuget/v/SenseNet.OAuth.Google.svg)](https://www.nuget.org/packages/SenseNet.OAuth.Google)

These providers are available as nuget packages on the server side and npm packages on the client. Please follow the instructions in the nuget readme, these packages usually involve executing an install command before you can use them.

## Custom OAuth provider
The OAuth provider feature is extendable by design, so developers may create a custom provider for any 3rd party service by implementing a simple api. For detailed explanation of the api elements to implement please refer to the source code documentation.

```csharp
public class CustomOAuthProvider : OAuthProvider
{
public override string IdentifierFieldName { get; } = "CustomUserId";
public override string ProviderName { get; } = "myservicename";

public override IOAuthIdentity GetUserData(object tokenData)
{
return tokenData as OAuthIdentity;
}

public override string VerifyToken(HttpRequestBase request, out object tokenData)
{
dynamic userData;

try
{
userData = GetUserDataFromToken(request);
}
catch (Exception)
{
throw new InvalidOperationException("OAuth error: cannot parse user data from the request.");
}

tokenData = new OAuthIdentity
{
Identifier = userData.sub,
Email = userData.email,
Username = userData.sub,
FullName = userData.name
};

return userData.sub;
}

private static dynamic GetUserDataFromToken(HttpRequestBase request)
{
string body;
using (var reader = new StreamReader(request.InputStream))
{
body = reader.ReadToEnd();
}

dynamic requestBody = JsonConvert.DeserializeObject(body);
string token = requestBody.token;

//TODO: verify token and extract basic user data
// return userData
}
}
```

The example above assumes that there is a field on the User content type called *CustomUserId*. Registering this field is the responsibility of the provider install process.

To start using your custom provider you only have to add a reference to your provider library and sensenet ECM will automatically discover and register your class.

## Client api
If you are using the [JavaScript client SDK](https://github.com/SenseNet/sn-client-js) (as it is recommended), you do not have to deal with sending OAuth tokens to the server, it will do it for you.

## REST api
As an alternative, you can use the native REST api when authenticating with a 3rd party OAuth service. After receiving the service-specific token, that token has to be sent to the server for verification. The api is the following:

```text
/sn-oauth/login?provider=providername
```

For example:

```javascript
$.ajax({
url: "/sn-oauth/login?provider=google",
dataType: "json",
type: 'POST',
data: JSON.stringify({ 'token':id_token }),
success: function () {
console.log('Success');
}
});
```
9 changes: 6 additions & 3 deletions docs/sensenet-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ This is a list of the main components we published so far. To see an expanded, c
###### Feature packages
- [Workspaces](#Workspaces): Workspace-related items (content types and templates, workspace dashboards and views) for sensenet ECM.
- [Workflow](#Workflow): Windows Workflow Foundation (WWF 4.5) integration into sensenet ECM.
- Content templates
- Notification
- [Notification](#Notification): Email notification component for the sensenet ECM platform.
- ...and more!

###### Client SDKs
Expand Down Expand Up @@ -77,4 +76,8 @@ The [Workspaces component](https://github.com/SenseNet/sn-workspaces) is useful

<a name="Workflow"></a>
## Workflow
Integrating **Windows Workflow Foundation (WWF 4.5)** into sensenet ECM provides many possibilities for creating content-driven workflows. The [Workflow component](https://github.com/SenseNet/sn-workflow) adds a robust and customizable workflow engine to sensenet ECM.
Integrating **Windows Workflow Foundation (WWF 4.5)** into sensenet ECM provides many possibilities for creating content-driven workflows. The [Workflow component](https://github.com/SenseNet/sn-workflow) adds a robust and customizable workflow engine to sensenet ECM.

<a name="Notification"></a>
## Notification
[Email notification component](https://github.com/SenseNet/sn-notification) for the sensenet ECM platform. Lets users subscribe to content changes and receive emails either almost immediately or in an aggregated way periodically about changes in the repository.
85 changes: 82 additions & 3 deletions docs/snadmin-builtin-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,15 @@ If the Path is a Content Repository path, than you can define a Field (optionall

You can define either the *Template* or the *Regex* property for searching replaceable text, but **not both of them**.

### SetUrl
- Full name: `SenseNet.Packaging.Steps.SetUrl`
- Default property: `Url`
- Additional properties: `Site, AuthenticationType`

Sets a url on a site content in the Content Repository. If the url is already assigned to another site, this step will fail.

>Please make sure that a **StartRepository** step precedes this one to make sure that the repository is started.
## JSON text
### EditJson
- Full name: `SenseNet.Packaging.Steps.EditJson`
Expand Down Expand Up @@ -475,6 +484,76 @@ Target XML after execution:
</testxml>
```

### MoveXmlElement
- Full name: `SenseNet.Packaging.Steps.MoveXmlElement`
- Default property: -
- Additional properties: `Xpath, TargetXpath, TargetParentXpath, TargetName, File, Content, Field`

Moves the given xml elements (selected by the Xpath property) as child elements under the xml element determined by the TargetXpath property. The xml can be in the file system (usually a .config file) or in the Content Repository (a field value of a content).

If the target element does not exist, you can configure this step to create it by providing an xpath value of the *parent* element of the target (using the TargetParentXpath property) and the name of the target (TargetName property).

>If the target is a content, please make sure that a **StartRepository** step precedes this one to make sure that the repository is started.
For example we want to modify the “test.xml” file in the App\_Data directory. First here is the package step:
``` xml
<MoveXmlElement file="App_Data\test.xml" xpath="/testxml/oldsection/myElement" targetXpath="/testxml/target" />
```
The target XML before execution:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<testxml>
<target></target>
<oldsection>
<myElement key="abc" />
<nestedElement />
</oldsection>
</testxml>
```
Target XML after execution:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<testxml>
<target>
<myElement key="abc" />
</target>
<oldsection>
<nestedElement />
</oldsection>
</testxml>
```

Moving multiple elements to a new section:
``` xml
<MoveXmlElement file="App_Data\test.xml" xpath="/testxml/oldsection/myElement[contains(@key, 'abc')]" targetXpath="/testxml/target" targetParentXpath="/testxml" targetName="target" />
```
The target XML before execution:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<testxml>
<oldsection>
<myElement key="abc1" />
<myElement key="abc2" />
<myElement key="def" />
<nestedElement />
</oldsection>
</testxml>
```
Target XML after execution:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<testxml>
<oldsection>
<myElement key="def" />
<nestedElement />
</oldsection>
<target>
<myElement key="abc1" />
<myElement key="abc2" />
</target>
</testxml>
```

### DeleteXmlNodes
- Full name: `SenseNet.Packaging.Steps.DeleteXmlNodes`
- Default property: -
Expand Down Expand Up @@ -1131,7 +1210,7 @@ In the opposite case, when an error is detected in the environment and any furth
```

### CreateEventLog
- Full name: `vSenseNet.Packaging.Steps.CreateEventLog`
- Full name: `SenseNet.Packaging.Steps.CreateEventLog`
- Default property: -
- Additional properties: `LogName, Machine, Sources`

Expand All @@ -1142,8 +1221,8 @@ System step for creating the provided log and source in Windows Event log.
```xml
<CreateEventLog LogName="@logName" Machine="@machine" Sources="@sources" />
```
##x DeleteEventLog
- Full name: `SenseNet.Packaging.Steps.CreateEventLog`
### DeleteEventLog
- Full name: `SenseNet.Packaging.Steps.DeleteEventLog`
- Default property: -
- Additional properties: `LogName, Machine, Sources`

Expand Down
20 changes: 20 additions & 0 deletions docs/snadmin-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ Exporting only selected (filtered) content items using the [Content Query syntax
SnAdmin export source:"/Root/Sites/MySite/articles" target:"c:\localrepo" filter:"+TypeIs:Article +CreationDate:<@@CurrentDate+3days@@"
```

## delete
Deletes a content from the repository.

``` text
SnAdmin delete path:/Root/MyFolder/MyContent
```

## seturl
Setting a url on the default site:

``` text
SnAdmin seturl url:demo.example.com
```

A more complex scenario:

``` text
SnAdmin seturl url:demo.example.com site:MySite authenticationType:Windows
```

## index
Re-create the index for the whole Content Repository (in case of a large repository this may take time).
``` text
Expand Down
Loading

0 comments on commit ef0217a

Please sign in to comment.