package org.restdoc.cxf;

import org.restdoc.server.ext.oauth2.OAuth2Extension;
import org.restdoc.server.impl.RestDocGenerator;

public abstract class RestDocFeatureOAuth2 extends RestDocFeature {

	@Override
	protected void customInit(final RestDocGenerator generator) {
		final OAuth2Extension oauth = new OAuth2Extension(this.getTokenURL(), this.getAuthURL(), this.getGrants());
		oauth.setClientaccess(this.getClientAccess());
		generator.registerGeneratorExtension(oauth);
	}

	protected abstract String getTokenURL();

	protected abstract String getAuthURL();

	protected abstract String[] getGrants();

	protected abstract String getClientAccess();

}

@@ -19,16 +19,53 @@
 c.cxf;%0A%0A
+import org.restdoc.api.GlobalHeader;%0A
 import o
@@ -513,16 +513,242 @@
 h);%0A%09%7D%0A%0A
+%09@Override%0A%09protected GlobalHeader getHeader() %7B%0A%09%09final GlobalHeader gh = this.customHeader();%0A%09%09gh.request(%22Authorization%22, %22Bearer: %3Coauth2 Token%3E%22, true);%0A%09%09return gh;%0A%09%7D%0A%0A%09protected abstract GlobalHeader customHeader();%0A%0A
 %09protect

add global header info