• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERRest - IERXRestAuthenticationDelegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERRest - IERXRestAuthenticationDelegate


  • Subject: Re: ERRest - IERXRestAuthenticationDelegate
  • From: Pascal Robert <email@hidden>
  • Date: Mon, 05 Mar 2012 04:45:44 -0500

Le 2012-03-05 à 04:26, Ron X a écrit :

> Hi.
> IERXRestAuthenticationDelegate is considered deprecated.
> What class i should use?
> Thank you.

You can override performActionNamed in your REST controller to check if the request is authenticated. Example:

  @Override
  public WOActionResults performActionNamed(String actionName, boolean throwExceptions)  {
    try {
      initTokenAuthentication();
    } catch (MemberException ex) {
      return pageWithName(LoginPage.class);
    } catch (NotAuthorizedException ex) {
      return pageWithName(LoginPage.class);
    }
    return super.performActionNamed(actionName, throwExceptions);
  }

  protected void initTokenAuthentication() throws NotAuthorizedException {
    String tokenValue = this.request().cookieValueForKey("someToken");
    if (tokenValue != null) {
      String username = crypter.decrypt(tokenValue);
      SomeEO eo = SomeEO.fetchSomeEO(editingContext(), SomeEO.USERNAME.eq(username));
      if (eo == null) {
        throw new NotAuthorizedException();
      }
    } else {
      throw new NotAuthorizedException();
    }
  }
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >ERRest - IERXRestAuthenticationDelegate (From: Ron X <email@hidden>)

  • Prev by Date: ERRest - IERXRestAuthenticationDelegate
  • Next by Date: Re: Opinions on OpenJDK
  • Previous by thread: ERRest - IERXRestAuthenticationDelegate
  • Next by thread: ERRest - @PathParam
  • Index(es):
    • Date
    • Thread