Hi,

i've extended an org.wicketstuff.rest.resource.AbstractRestResource and mounted 
it in my WebApplication.
Everything works so far.

But i've annotated my Method with a role that shall be extracted from the 
session. I'm not quite sure how to
'login' my import command (CLI) as a user

Has someone maybe a working example for authorized resource access?

Thanks
Per

<code>
@AuthorizeResource
public class CRMDataImportResource extends 
AbstractRestResource<JsonWebSerialDeserial> {

  @SpringBean(name = "FullImport")
  private DataImport dataImport;

  public CRMDataImportResource() {
    super(new JsonWebSerialDeserial(
        new GsonObjectSerialDeserial()), new IRoleCheckingStrategy() {
                                
            @Override
            public boolean hasAnyRole(Roles roles) {
              CDISession session = CDISession.get();
              return session.hasAnyRole(roles);
            }
        }
    );
    Injector.get().inject(this);
  }

  @MethodMapping(
    value = "/full",
    httpMethod = HttpMethod.POST)
  @AuthorizeInvocation("CRMDataImport")
  public String fullImport(@RequestBody DocumentBatch batch) throws Exception {
    return dataImport.fullImport(batch);
  }
}
</code>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to