Examples of OAuthContext


Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getMatchedPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getMatchedPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    this.accounts = accounts;
  }
 
  @GET
  public Calendar getUserCalendar() {
      OAuthContext oauth = getOAuthContext();
      String userName = oauth.getSubject().getLogin();
    return accounts.getAccount(userName).getCalendar();
  }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

  public void updateCalendar(@FormParam("hour") int hour,
                             @FormParam("description") String description) {
      // This permission check can be done in a custom filter; it can be simpler to do
      // in the actual service code if the context data (such as an hour in this case)
      // are not available in the request URI but in the message payload
      OAuthContext oauth = getOAuthContext();
      List<OAuthPermission> perms = oauth.getPermissions();
      boolean checkPassed = false;
      for (OAuthPermission perm : perms) {
          if (perm.getPermission().startsWith(OAuthConstants.UPDATE_CALENDAR_SCOPE)) {
              int authorizedHour =
                  Integer.valueOf(perm.getPermission().substring(OAuthConstants.UPDATE_CALENDAR_SCOPE.length()));
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

      Calendar calendar = getUserCalendar();
      calendar.getEntry(hour).setEventDescription(description);
  }
 
  private OAuthContext getOAuthContext() {
      OAuthContext oauth = mc.getContent(OAuthContext.class);
        if (oauth == null || oauth.getSubject() == null || oauth.getSubject().getLogin() == null) {
            throw new WebApplicationException(403);
        }
        return oauth;
  }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getMatchedPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getMatchedPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.OAuthContext

            
        };
    }
   
    protected OAuthContext createOAuthContext(OAuthInfo info) {
        OAuthContext context = new OAuthContext();
        if (info.getToken() != null) {
            context.setSubject(info.getToken().getSubject());
        }
        return context;
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.common.OAuthContext

     * @param mc the {@link MessageContext}
     * @return the id of the UserSubject of the logged in user or resource owner
     * @throws WebApplicationException with Status 401 if not authenticated
     */
    public static String resolveUserId(final MessageContext mc) {
        final OAuthContext oauth = getContext(mc);
        return oauth.getSubject().getId();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.