Upload
corley-srl
View
538
Download
6
Embed Size (px)
Citation preview
AngularJSon Cloud
AngularConf 2015
Who am I?Gianluca Arbezzano
@gianarb
I'm here to protect you
Software Engineer @CorleyCloud
When you think "Infrastructure"
Think of word without SysAdmin
Great!
The mission:
build an application managed byAWS
to avoid sysadmin
Security Issues
Without servers where do you store private credentials?
Cognito identity
Helps your client app to manage authentication and it opens the doors of AWS world
in AngularJS// app/app.js.config([function() var creds = new AWS.CognitoIdentityCredentials( IdentityPoolId: 'useast1:0000000000000008c3c5397a17ad174' ); AWS.config.update( region: 'useast1', credentials: creds );]);
in AngularJS.directive('googleSignin', function() return restrict: 'A', template: '<span id="signinButton"></span>', replace: true, scope: afterSignin: '&' , link: function(scope, ele, attrs) // see ngnewsletter.com/posts/awsjssdk.html ;)
in AngularJS// app/view/view.tpl.html<p>This is the partial for view 1.</p><h2>Signin to ngroad</h2>
<div googlesignin clientid='3818201' aftersignin="signedIn(oauth)" datauser="user"></div><pre> user | json </pre>
in AngularJS$scope.signedIn = function(oauth) var creds = params: ; $scope.user = oauth; creds = AWS.config.credentials; creds.params.Logins = ; creds.params.Logins['accounts.google.com'] = oauth.id_token; AWS.config.update( credentials: creds ); AWS.config.credentials.refresh(function(err) if (err) console.log(err); ); ;
Chamber of Secrets was open
in AngularJS
in AngularJS
DynamoDBis a fully managed NoSQL database service that erovides
fast and predictable performance
with seamless scalability
in AngularJS
in AngularJS
in AngularJS<p>This is the partial for view 1.</p><h2>Signin to ngroad</h2>
<div googlesignin clientid='38182010900e5l22mddk7oliohktn747trqgsfau1rd' aftersignin="signedIn(oauth)" datauser="user"></div><pre> user | json </pre>
<form ngsubmit="send(item)"><input ngmodel="item.title"><button type="submit">Save</button></form>
in AngularJS$scope.send = function(item) AWS.config.getCredentials(function() var dynamodb = new AWS.DynamoDB(apiVersion: '20120810'); dynamodb.putItem( Item: "title": "S": item.title , TableName: "angularconf" , function(err, data) if(err) throw err; ); );;
DynamoDB
DynamoDB
working on your data
Allow permission for singlelines
Allow permission for singlecolumns
working on your data "Version": "20121017", "Statement": [ "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem" ], "Resource": ["arn:aws:dynamodb:uswest2::table/GameScores"], "Condition": "ForAllValues:StringEquals": "dynamodb:LeadingKeys": ["$www.amazon.com:user_id"] ]
Other AWS servicesSQS
S3
Cognito Sync
docs.aws.amazon.com/AWSJavaScriptSDK
Thanksgithub.com/gianarb