org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder Java Examples

The following examples show how to use org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Oauth2ImplicitClient.java    From components with Apache License 2.0 6 votes vote down vote up
private String getAuthorizationCode() {
    try {
        AuthenticationRequestBuilder builder = OAuthClientRequest.authorizationLocation(authorizationLocation.toString())
                .setClientId(clientID).setRedirectURI(callbackURL.toString());
        if (responseType != null) {
            builder.setResponseType(responseType);
        }
        OAuthClientRequest request = builder.buildQueryMessage();

        // FIXME : remove those Syso when the studio activate the INFO log by default
        System.out.println(messages.getMessage("msg.info.showAuthorizUrl"));
        System.out.println(request.getLocationUri());
        // --
        logger.info(messages.getMessage("msg.info.showAuthorizUrl"));
        logger.info(request.getLocationUri());
        OAuth2ImplicitGrantServer service = new OAuth2ImplicitGrantServer(callbackURL.getHost(), callbackURL.getPort(),
                10 * 60 * 1000);
        service.run();// <--- this method wait for 10 minutes maximum to grab authorization code
        String code = service.getAuthorizationCode();
        service.stop();
        return code;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #2
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(Interceptor apiAuthorization : apiAuthorizations.values()) {
    if (apiAuthorization instanceof OAuth) {
      OAuth oauth = (OAuth) apiAuthorization;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #3
Source File: ApiClient.java    From docusign-java-client with MIT License 5 votes vote down vote up
/**
  * Helper method to configure authorization endpoint of the first oauth found in the authentications (there should be only one)
  * @return
  */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(Authentication auth : authentications.values()) {
   if (auth instanceof OAuth) {
      OAuth oauth = (OAuth) auth;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #4
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(Interceptor apiAuthorization : apiAuthorizations.values()) {
    if (apiAuthorization instanceof OAuth) {
      OAuth oauth = (OAuth) apiAuthorization;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #5
Source File: GoogleOAuthParams.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
public void addAdditionsParams(AuthenticationRequestBuilder requestBuiler) throws OAuthException {
	try {
		URL currentURL = getCurrentURL();
		// Add realm for openId 2.0 migration
		String realm = new URL(currentURL.getProtocol(), currentURL.getHost(), currentURL.getPort(), "").toString();
		requestBuiler.setParameter(OPEN_ID_PARAMETER, realm);
	} catch (MalformedURLException e) {
		throw new OAuthException("An Error occured while building the request URL");
	}
}
 
Example #6
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(Interceptor apiAuthorization : apiAuthorizations.values()) {
    if (apiAuthorization instanceof OAuth) {
      OAuth oauth = (OAuth) apiAuthorization;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #7
Source File: ApiClient.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
    if (apiAuthorization instanceof OAuth) {
      OAuth oauth = (OAuth) apiAuthorization;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #8
Source File: ApiClient.java    From android with MIT License 5 votes vote down vote up
/**
 * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
 * @return Authentication request builder
 */
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
  for(Interceptor apiAuthorization : apiAuthorizations.values()) {
    if (apiAuthorization instanceof OAuth) {
      OAuth oauth = (OAuth) apiAuthorization;
      return oauth.getAuthenticationRequestBuilder();
    }
  }
  return null;
}
 
Example #9
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
    this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #10
Source File: OAuth.java    From docusign-java-client with MIT License 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
	this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #11
Source File: OAuth.java    From docusign-java-client with MIT License 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
	return authenticationRequestBuilder;
}
 
Example #12
Source File: OAuth.java    From docusign-java-client with MIT License 4 votes vote down vote up
public OAuth(Client client, TokenRequestBuilder tokenRequestBuilder, AuthenticationRequestBuilder authenticationRequestBuilder) {
	this.oauthClient = new OAuthClient(new OAuthJerseyClient(client));
	this.tokenRequestBuilder = tokenRequestBuilder;
	this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #13
Source File: OAuthParams.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
public void addAdditionsParams(AuthenticationRequestBuilder requestBuiler) throws OAuthException {
	return;
}
 
Example #14
Source File: OAuth.java    From android with MIT License 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
    this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #15
Source File: OAuth.java    From android with MIT License 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
    return authenticationRequestBuilder;
}
 
Example #16
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
    return authenticationRequestBuilder;
}
 
Example #17
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
    this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #18
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
    return authenticationRequestBuilder;
}
 
Example #19
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
    this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #20
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
    return authenticationRequestBuilder;
}
 
Example #21
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
    this.authenticationRequestBuilder = authenticationRequestBuilder;
}
 
Example #22
Source File: OAuth.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
    return authenticationRequestBuilder;
}