Skip to content

Instantly share code, notes, and snippets.

View abstractj's full-sized avatar

Bruno Oliveira da Silva abstractj

View GitHub Profile
  1. Deploy aerogear-controller-demo
  2. Try ios-otp-demo to login and validate otp
  3. Log in to aerogear-controller-demo with user 'john'
  4. Use the restricted admin page to register a new user
  5. Delete the newly created user
  6. Try the iso-otp-demo once again. For me the error below will be displayed in the servers console
11:00:24,761 INFO  [stdout] (http--127.0.0.1-8080-3) [Demo Error handler :null
11:00:24,788 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8080-3) JBAS014134: EJB Invocation failed on component Otp for method public org.jboss.aerogear.security.model.AeroGearUser org.jboss.aerogear.controller.demo.Otp.secret(): javax.ejb.EJBException: java.lang.NullPointerException

This is my route :

route().from("/customers/{id}")
.on(RequestMethod.GET)
.consumes(JSON).produces(JSON)
.to(CustomerEndpoint.class)
.findById(param("id");

This the method of my endpoint :

Pagination RESTFul API on AeroGear Controller

This document describes pagination in AeroGear. It defines the metadata passed between the client and server.

Parameters

  • offset
    The offset of the first element that should be included in the returned collection. Default value is 0.
  • limit
    The number of elements that should be returned. Default value is 10
  • total
    The total number of elements available.
@abstractj
abstractj / gist:4537563
Last active December 11, 2015 03:28 — forked from danbev/gist:4537431

Pagination RESTFul API on AeroGear Controller

This document describes pagination in AeroGear. This includes the client APIs (Android, JavaScript, and iOS) and also the server side (AeroGear Controller)

Parameters

  • offset
    The offset of the first element that should be included in the returned collection. Default value is 0.
  • limit
    The number of elements that should be returned. Default value is 10
  • total
    The total number of elements available.
require 'rubygems'
require 'rack/oauth2'
client = Rack::OAuth2::Client.new(
:identifier => YOUR_CLIENT_ID,
:secret => YOUR_CLIENT_SECRET,
:redirect_uri => YOUR_REDIRECT_URI, # only required for grant_type = :code
:host => 'rack-oauth2-sample.heroku.com'
)
require 'rubygems'
require 'rack/oauth2'
client = Rack::OAuth2::Client.new(
:identifier => YOUR_CLIENT_ID,
:secret => YOUR_CLIENT_SECRET,
:redirect_uri => YOUR_REDIRECT_URI, # only required for grant_type = :code
:host => 'rack-oauth2-sample.heroku.com'
)
require 'rubygems'
require 'rack/oauth2'
def url_for(path)
File.join("https://rack-oauth2-sample-mac.heroku.com", path)
end
resource_of = :user
case resource_of
require 'rubygems'
require 'rack/oauth2'
def url_for(path)
File.join("http://rack-oauth2-sample.heroku.com", path)
end
resource_of = :user
case resource_of
@abstractj
abstractj / gist:4031896
Created November 7, 2012 14:24 — forked from danbev/gist:4023803
AeroGear Server Side Interfaces

AeroGear Server Side Interfaces

This document describes the server side interfaces for AeroGear. Since all interactions use the Http protocol the interfaces in question are resource URLs.

Some of the exposed resource URLs are specific to AeroGear, for example if AeroGear-Security is in use, then there are certain URL that are exposed by default. But for most of the resource URLs the actual composition of the URLs is specific to the server side application. This document's indent is to be a guide for users creating new RESTful server side applications as well as for client developers to know how to interact with RESTful applications (what request/responses will look like).

Transport protocol

The APIs described in this document are based on Hypertext Transfer Protocol, version 1.1 and https is recommended. Please refer to the security section of this document for details why https is important.

Resources

A resource, or an endpoint, is identified by

@abstractj
abstractj / gist:4002565
Created November 2, 2012 16:41 — forked from danbev/gist:4001775
Handling SecurityProvider Responses in AeroGear-Controller

Handling SecurityProvider Responses within AeroGear-Controller

This gist is a follow up a previous gist that investigated using CDI events for handling SecurityProvider responses.

Background

In short, a route can be configured so that only users belonging to certain groups can access the target endpoint. For example:

route()
       .from("/delorean").roles("admin")
 .on(RequestMethod.GET)