Skip to content

Instantly share code, notes, and snippets.

View matzew's full-sized avatar
💩
hacking hacking hacking!

Matthias Wessendorf matzew

💩
hacking hacking hacking!
  • Red Hat
  • Emsdetten, Germany
View GitHub Profile
@matzew
matzew / gist:3757841
Created September 20, 2012 19:25
Mixing Pipe and data storage
// Get SOMEHOW... a reference to a pipe
id<AGPipe> tasksPipe = ...
// create new store:
AGDataManager* mgr = [[AGDataManager alloc] init];
id<AGStore> tasksStore = [mgr add:@"tasks"];
...
// later in the program....
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AGTask", referenced from:
objc-class-ref in AGTasksViewController.o
(maybe you meant: _OBJC_CLASS_$_AGTasksViewController)
"_OBJC_CLASS_$_AGTaskViewController", referenced from:
objc-class-ref in AGTasksViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
// WRONG authenticator (or even nil)
var somePipeline = aerogear.pipeline([ { name: "tasks", settings: { baseURL: "somePROTECTED_URL", authenticator: null}}]);
var myPipe = somePipeline.pipes["tasks"];
myPipe.read(); // returns 401 status-code when going against a SERVER that requires auth
However, 'myPipe.isAuthenticated()' returns TRUE as the default... - which is wrong when no (or 'wrong') authenticator has been attached.
// ==== SRC of isAuthenticated ====
isAuthenticated: function() {
@matzew
matzew / gist:3832056
Created October 4, 2012 07:52
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

@matzew
matzew / gist:3833331
Created October 4, 2012 12:45
AGAuthenticationManager
/**
* AGAuthenticationManager manages different AGAuthenticationModule implementations. It is basically a
* factory that hides the concrete instanciation of a specific AGAuthenticationModule implementation.
* The class offers simple APIs to add, remove or get access to a 'authentication module'.
*
*/
@interface AGAuthenticationManager : NSObject
/**
@matzew
matzew / gist:3833333
Created October 4, 2012 12:46
AGAuthenticationModule
/**
* AGAuthenticationModule represents an authentication module...
*/
@protocol AGAuthenticationModule <NSObject>
/**
* Returns the type of the underlying 'auth module implementation'
*/
@property (nonatomic, readonly) NSString* type;
// Instantiate our authenticator
var restAuth = aerogear.auth({
name: "auth",
settings: {
agAuth: true,
baseURL: "/todo-server/"
}
}).modules.auth;
@matzew
matzew / gist:3833597
Created October 4, 2012 13:42
Usage of AGAuthenticationManager and AGAuthenticationModule for signup/signin/signout
// create an auth manager object
AGAuthenticationManager* authMgr = [AGAuthenticationManager manager];
// add a new auth module and the required 'base url':
NSURL* baseURL = [NSURL URLWithString:@"https://todoauth-aerogear.rhcloud.com/todo-server"];
id<AGAuthenticationModule> myMod = [authMgr add:@"authMod" baseURL:baseURL];
// ====================================
@matzew
matzew / gist:3834288
Created October 4, 2012 15:15
settings
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@matzew
matzew / gist:3838816
Created October 5, 2012 08:51 — forked from kborchers/gist:3833435
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib: