Skip to content

Instantly share code, notes, and snippets.

View abstractj's full-sized avatar

Bruno Oliveira da Silva abstractj

View GitHub Profile
# is the url for retrieve the openid configuration - normally the <server>/auth/realm/<realm_name>
discovery-url: http://localhost:8180/auth/realms/summit
# the client id for the 'client' application
client-id: go-rest
# the interface definition you wish the proxy to listen, all interfaces is specified as ':<port>'
listen: 127.0.0.1:4000
# log all incoming requests
enable-logging: true
# log in json format
@abstractj
abstractj / gist:d7e1ca70519184ed1e8701be6729ebbf
Created June 21, 2017 22:59 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
if (!this.identity.isLoggedIn()) {
this.credentials.setUserId(saleAgent.getLoginName());
this.credentials.setPassword(saleAgent.getPassword());
this.identity.login();
} else {
throw new RuntimeException("Authentication failed");
}
@abstractj
abstractj / shot.js
Created July 25, 2013 20:07 — forked from ahomu/shot.js
console.log('Loading a web page');
var page = require('webpage').create();
var url = 'http://localhost:1947/';
page.viewportSize = {
width: 1024,
height: 768
};
page.open(url, function (status) {
//Page is loaded!
var iz, i = 0, queue = {};
  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'
def url_for(path)
File.join("https://rack-oauth2-sample-mac.heroku.com", path)
end
resource_of = :user
case resource_of