Refactoring according to latest GateIn changes in oauth branch