Skip to content

Commit

Permalink
4.1.0-beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamensuli committed Jan 9, 2019
1 parent 2d60173 commit 1c5cb68
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 12,099 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v4.1.0-beta.3 (08/01/2019)
- [nodefony release 4.1.0-beta.3](https://github.com/nodefony/nodefony-core/commit/9edc63ea407a1d1ba9d653764eef284decfd1b8f)
- [add firewall config social login](https://github.com/nodefony/nodefony-core/commit/77950b749c6cf67d99a88771e6b493e906144fef)
- [add social button in login oauth connection](https://github.com/nodefony/nodefony-core/commit/ad47a2b11a011fbece3f5170763493dea7fbe469)

---

## v4.1.0-beta.2 (06/01/2019)
- [nodefony release 4.1.0-beta.2](https://github.com/nodefony/nodefony-core/commit/56723c17bd96a4f307eb5e759b9ae5ba32889d86)

Expand Down
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[![npm package](https://nodei.co/npm/nodefony.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/nodefony)

[![Issues Status](https://img.shields.io/github/issues/nodefony/nodefony.svg)](https://github.com/nodefony/nodefony/issues) [![Build Status](https://travis-ci.org/nodefony/nodefony.svg?branch=master)](https://travis-ci.org/nodefony/nodefony) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/495/badge)](https://bestpractices.coreinfrastructure.org/projects/495)
[![Issues Status](https://img.shields.io/github/issues/nodefony/nodefony.svg)](https://github.com/nodefony/nodefony/issues) [![Build Status](https://api.travis-ci.org/nodefony/nodefony-core.svg?branch=master)](https://travis-ci.org/nodefony/nodefony-core) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/495/badge)](https://bestpractices.coreinfrastructure.org/projects/495)

Nodefony is Node.js full-stack web framework.

Expand Down Expand Up @@ -36,13 +36,13 @@ Nodefony is not an exhaustive port of symfony !
- [HTTP2](https://nodejs.org/api/http2.html) http2 ready node module provides an implementation of the HTTP/2 (push server ready).
- Dynamics routing
- ORM ([Sequelize](http://docs.sequelizejs.com/), [mongoose](http://mongoosejs.com/index.html))
- Simple Databases connection (mongo, ...)
- Simple Databases Services connections (Redis, Mongo, Elasticsearch).
- MVC templating ([Twig](https://github.com/twigjs/twig.js))
- Notion of real-time context in Action Controller (websocket).
- Notion of synchronous or asynchronous execution in Action Controller (Promise).
- Services Containers, Dependency Injection (Design Patterns)
- Sessions Manager (ORM, memcached)
- Authentication Manager (Digest, Basic, oAuth, Local, ldap, jwf)
- Authentication Manager (Digest, Basic, oAuth, Local, ldap, jwf, openid)
- WAF ( Web application firewall )
- Cross-Origin Resource Sharing ([CORS](https://www.w3.org/TR/cors/))
- Production Management ([PM2](https://github.com/Unitech/pm2/))
Expand Down Expand Up @@ -363,27 +363,35 @@ system:
- "^localhost$"
httpPort : 5151
httpsPort : 5152
domainCheck : true
statics : true
domainCheck : false
locale : en_en
##############
# BUNDLES CORE
security : true
realtime : true
monitoring : true
documentation : true
unitTest : true
demo : true
locale : "en_en"
redis : false
mongo : false
elastic : false
#########
# SERVERS
servers:
statics : true
protocol : "2.0" # 2.0 || 1.1
http : true
https : true
ws : true
https : true
ws : true
wss : true
certificats:
key : "config/certificates/server/privkey.pem"
cert : "config/certificates/server/fullchain.pem"
ca : "config/certificates/ca/projectName-root-ca.crt.pem"
ca : "config/certificates/ca/nodefony-starter-root-ca.crt.pem"
options:
rejectUnauthorized : true
############
# DEV SERVER
devServer:
inline : true
hot : false
Expand All @@ -393,8 +401,14 @@ system:
progress : false
protocol : https
websocket : true
bundles:
hello-bundle : "file:src/bundles/hello-bundle"

#######################
# BUNDLES REGISTRATION
#
# bundles:
# hello-bundle : "file:src/bundles/hello-bundle"
# my-bundle : ~
bundles : ~
```
## <a name="bundles"></a>Quick Start
Expand Down
Binary file modified app/Resources/databases/nodefony.db
Binary file not shown.
2 changes: 1 addition & 1 deletion app/Resources/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"display": "standalone",
"start_url": "/",
"launch_path": "/",
"description": "description nodefony-starter",
"description": "Project nodefony-starter",
"default_locale": "en",
"background_color": "#2196F3",
"theme_color": "#2196F3",
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/translations/users.fr_fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ users : Utilisateurs
username : Utilisateur
firstName : Prénom
lastName : Nom
email : Addresse Email
email : Adresse Email
textEmail : Nous ne partagerons jamais votre email avec qui que ce soit.
gender : Genre
role : Role
Expand Down
10 changes: 9 additions & 1 deletion app/Resources/views/login/login.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@
<button class="btn btn-lg btn-primary btn-block mt-4" type="submit">{{trans("submit")}}</button>
</form>
<a href="{{url("nodefony-user-create")}}" class="mt-5 mb-3 text-muted">{{"register"|trans}}</a>
<p class="mt-5 mb-3 text-muted">© {{year}}</p>
<p class="mt-5 mb-3 text-muted">
{% if github %}
<a href="/login/github" class="btn btn-secondary fa fa-github"> &nbsp {{trans("login")}} with Github</a>
{% endif %}
{% if google %}
<a href="/login/google" class="btn btn-danger fa fa-google">&nbsp {{trans("login")}} with Google</a>
{% endif %}
</p>
<p class="mt-3 mb-3 text-muted">© {{nodefony.name}}</p>
</div>
</div>
{% block footer %}
Expand Down
26 changes: 26 additions & 0 deletions app/config/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,30 @@ module.exports = {
controller: "app:app:index"
}
}
//GOOGLE AUTH AREA
/*googleArea: {
pattern: "/login/google",
defaults: {
controller: "framework:default:401"
}
},
googleCallBackArea: {
pattern: "/login/google/callback",
defaults: {
controller: "framework:default:401"
}
},
// GITHUB AUTH AREA
githubArea: {
pattern: "/login/github",
defaults: {
controller: "framework:default:401"
}
},
githubCallBackArea: {
pattern: "/login/github/callback",
defaults: {
controller: "framework:default:401"
}
}*/
};
141 changes: 109 additions & 32 deletions app/config/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,134 @@
security:
####################
# FIREWALL strategy
# when change security context (multi firewalls areas)
# when change security context (usefull with multi firewalls areas)
#
# Strategy can be : none, migrate, invalidate
# Strategy can be : none, migrate, invalidate
#
session_fixation_strategy: migrate

##################
# FIREWALL AREAS
#
firewalls:
# SECURITY AREA MONITORING <passport-local>
nodefony_area:
pattern : ^/nodefony
provider : nodefony
form_login:
login_path : /login/nodefony
check_path : /login/check
default_target_path : /
always_use_default_target_path : true
passport-local:
usernameField : 'username'
passwordField : 'passwd'
logout : /logout
context : ~
redirectHttps : true
session_fixation_strategy : migrate

#####################
# FIREWALL PROVIDER
#
providers:
anonymous:
anonymous:
provider: anonymous
provider : anonymous
nodefony:
entity:
name: "user"
property: "username"
name : "user"
property : "username"
encoders:
user :
algorithm: bcrypt
saltRounds: 13
algorithm : bcrypt
saltRounds : 13

##########################
# FIREWALL Authorization
#
access_control:
- {
path : ^/nodefony,
roles : ["ROLE_MONITORING"],
requires_channel : "https",
allow_if : {
path : ^/nodefony,
roles : ["ROLE_MONITORING"],
requires_channel : "https",
allow_if : {
roles:["ROLE_ADMIN"]
}
}

##################
# FIREWALL AREAS
#
firewalls:
# SECURITY AREA MONITORING <passport-local>
nodefony_area:
pattern : ^/nodefony
provider : nodefony
form_login:
login_path : /login/nodefony
check_path : /login/check
default_target_path : /
passport-local:
usernameField : 'username'
passwordField : 'passwd'
logout : /logout
context : ~
redirectHttps : true

######################
# SECURITY AREA GOOGLE
# https://console.developers.google.com
#
# google_area:
# pattern : ^/login/google
# provider : false
# form_login:
# default_target_path : /
# passport-google-oauth20 :
# clientID : "clientID"
# clientSecret : "clientSecret"
# callbackURL : "https://nodefony-starter.com/login/google/callback"
# scopes : ["profile","email"]
# logout : /logout
# context : google
# redirectHttps : true
# crossDomain :
# allow-origin:
# google : accounts.google.com
# Access-Control:
# Access-Control-Allow-Methods : "GET, POST, PUT, DELETE, OPTIONS"
# Access-Control-Allow-Headers : "ETag, Authorization, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type"
# Access-Control-Allow-Credentials: true
# Access-Control-Expose-Headers : "WWW-Authenticate ,X-Json"
# Access-Control-Max-Age : 10

######################
# SECURITY AREA GITHUB
#
# github_area:
# pattern : ^/login/github
# provider : false
# form_login:
# default_target_path : /
# passport-github2:
# clientID : "clientID"
# clientSecret : "clientSecret"
# callbackURL : "https://nodefony-starter.com/login/github/callback"
# scopes : [ "user:email" ]
# logout : /logout
# context : github
# redirectHttps : true
# crossDomain:
# allow-origin:
# github : github.com
# Access-Control:
# Access-Control-Allow-Methods : "GET, POST, PUT, DELETE, OPTIONS"
# Access-Control-Allow-Headers : "ETag, Authorization, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type"
# Access-Control-Allow-Credentials: true
# Access-Control-Expose-Headers : "WWW-Authenticate ,X-Json"
# Access-Control-Max-Age : 10

####################
# SECURITY AREA LDAP
# CHECK ldapjs-search -u ldap://ldap-server.com -b "dc=object,dc=com" "uid=user"
#
# ldap_area:
# pattern : ^/
# provider : false
# form_login:
# login_path : /login/ldap
# default_target_path : /
# passport-ldap:
# server:
# url : 'ldap://ldad-server.com'
# searchBase : 'dc=nodefony,dc=com'
# searchFilter : '(uid={{username}})'
# usernameField : 'username'
# passwordField : 'passwd'
# profile_wrapper:
# username : "profile.uid"
# name : "profile.sn"
# surname : "profile.givenName"
# email : "profile.mail"
# logout : /logout
# context : ldap
11 changes: 7 additions & 4 deletions app/controller/loginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = class loginController extends nodefony.controller {

constructor(container, context) {
super(container, context);
this.firewall = this.get("security");
this.security = this.get("security");
this.entity = this.getEntity("user");
this.startSession();
}
Expand All @@ -17,15 +17,18 @@ module.exports = class loginController extends nodefony.controller {
* )
*/
loginAction(type) {
let area = this.firewall.getSecuredArea(type);
let area = this.security.getSecuredArea(type);
let action = "/" + type;
if (area && area.checkLogin) {
action = area.checkLogin;
}
let google = this.security.getSecuredArea("google_area") ? true : false;
let github = this.security.getSecuredArea("github_area") ? true : false;
return this.render("app:login:login.html.twig", {
type: type,
action: action,
year: new Date().getFullYear()
google: google,
github: github
});
}

Expand Down Expand Up @@ -63,7 +66,7 @@ module.exports = class loginController extends nodefony.controller {
* @Route ("/logout", name="logout")
*/
logoutAction() {
return this.firewall.logout(this.context)
return this.security.logout(this.context)
.catch((e) => {
throw e;
});
Expand Down
Loading

0 comments on commit 1c5cb68

Please sign in to comment.