cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request: APIServlet, AuthCmd, SAML fixes
Date Mon, 10 Aug 2015 11:17:29 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/650#discussion_r36621140
  
    --- Diff: plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
---
    @@ -322,21 +306,11 @@ public String authenticate(final String command, final Map<String,
Object[]> par
                             if (_apiServer.verifyUser(userAccount.getId())) {
                                 LoginCmdResponse loginResponse = (LoginCmdResponse) _apiServer.loginUser(session,
userAccount.getUsername(), userAccount.getUsername() + userAccount.getSource().toString(),
                                         userAccount.getDomainId(), null, remoteAddress, params);
    -                            resp.addCookie(new Cookie("userid", URLEncoder.encode(loginResponse.getUserId(),
HttpUtils.UTF_8)));
    -                            resp.addCookie(new Cookie("domainid", URLEncoder.encode(loginResponse.getDomainId(),
HttpUtils.UTF_8)));
    -                            resp.addCookie(new Cookie("role", URLEncoder.encode(loginResponse.getType(),
HttpUtils.UTF_8)));
    -                            resp.addCookie(new Cookie("username", URLEncoder.encode(loginResponse.getUsername(),
HttpUtils.UTF_8)));
    -                            resp.addCookie(new Cookie("account", URLEncoder.encode(loginResponse.getAccount(),
HttpUtils.UTF_8)));
    -                            String timezone = loginResponse.getTimeZone();
    -                            if (timezone != null) {
    -                                resp.addCookie(new Cookie("timezone", URLEncoder.encode(timezone,
HttpUtils.UTF_8)));
    -                            }
    -                            resp.addCookie(new Cookie("userfullname", URLEncoder.encode(loginResponse.getFirstName()
+ " " + loginResponse.getLastName(), HttpUtils.UTF_8).replace("+", "%20")));
    -                            resp.addHeader("SET-COOKIE", String.format("%s=%s;HttpOnly",
ApiConstants.SESSIONKEY, loginResponse.getSessionKey()));
    +                            SAMLUtils.setupSamlUserCookies(loginResponse, resp);
                                 resp.sendRedirect(SAML2AuthManager.SAMLCloudStackRedirectionUrl.value());
                                 return ApiResponseSerializer.toSerializedString(loginResponse,
responseType);
                             }
    -                    } catch (final CloudAuthenticationException ignored) {
    +                    } catch (final Exception ignored) {
    --- End diff --
    
    Do we really want to ignore unchecked exceptions here?  Seems like we should be explicitly
catching the expected checked exceptions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message