Search in sources :

Example 1 with AuthorizationCodeRequestUrl

use of com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl in project fess by codelibs.

the class OpenIdConnectAuthenticator method getAuthUrl.

protected String getAuthUrl(final HttpServletRequest request) {
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    final String state = UuidUtil.create();
    request.getSession().setAttribute(OIC_STATE, state);
    return //
    new AuthorizationCodeRequestUrl(fessConfig.getOicAuthServerUrl(), fessConfig.getOicClientId()).setScopes(//
    Arrays.asList(fessConfig.getOicScope())).setResponseTypes(//
    Arrays.asList("code")).setRedirectUri(//
    fessConfig.getOicRedirectUrl()).setState(//
    state).build();
}
Also used : AuthorizationCodeRequestUrl(com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig)

Example 2 with AuthorizationCodeRequestUrl

use of com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl in project che by eclipse.

the class OAuthAuthenticator method getAuthenticateUrl.

/**
     * Create authentication URL.
     *
     * @param requestUrl
     *         URL of current HTTP request. This parameter required to be able determine URL for redirection after
     *         authentication. If URL contains query parameters they will be copy to 'state' parameter and returned to
     *         callback method.
     * @param scopes
     *         specify exactly what type of access needed
     * @return URL for authentication
     */
public String getAuthenticateUrl(URL requestUrl, List<String> scopes) throws OAuthAuthenticationException {
    if (!isConfigured()) {
        throw new OAuthAuthenticationException("Authenticator is not configured");
    }
    AuthorizationCodeRequestUrl url = flow.newAuthorizationUrl().setRedirectUri(findRedirectUrl(requestUrl)).setScopes(scopes);
    url.setState(prepareState(requestUrl));
    return url.build();
}
Also used : AuthorizationCodeRequestUrl(com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl)

Aggregations

AuthorizationCodeRequestUrl (com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl)2 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1