Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8710923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:44:53+00:00 2026-06-13T04:44:53+00:00

i have written a small grails webapp. I am using milton.io to access some

  • 0

i have written a small grails webapp. I am using milton.io to access some content via webdav.
So webdav is still working and i am able to put, get, delete files – and so on.
But now i want to add authentication and authorization. And here is the problem:

The Resource Interface gives me 2 methods:

Object authenticate(String user, String password);
boolean authorise(Request request, Request.Method method, Auth auth);

So my Resource classes implements the Resource Interface, but the method authenticate is never called by the framework. Do i have to implement Auth Basic by my self?

My knowledge about milton is very poor. May be i forgot something, cause my webdav client (e.g. cadaver) never asks for a username / password.

Thanks for any help
Peter Waver

Signature of my Resource Classes:

class SResource implements GetableResource, PropFindableResource, Resource, DeletableResource, MoveableResource,  ReportableResource, CopyableResource 

class SFileResource extends SResource implements ReplaceableResource

class SFolderResource extends SResource implements PutableResource, MakeCollectionableResource, CollectionResource

And here is the builder to get the HttpManager

class SMiltonConfig implements MiltonConfigurator {


protected HttpManagerBuilder builder;
protected List<Initable> initables;
protected HttpManager httpManager;

public SMiltonConfig(){
    try {
        // Attempt to use Enterprise edition build if available
        Class builderClass = Class.forName("io.milton.ent.config.HttpManagerBuilderEnt");
        builder = (HttpManagerBuilder) builderClass.newInstance();
        println ("load Ent. HTTP Manager")
    } catch (InstantiationException ex) {
        builder = new HttpManagerBuilder();
        println ("load Std. HTTP Manager")
    } catch (IllegalAccessException ex) {
        println ("load Std. HTTP Manager")
        builder = new HttpManagerBuilder();
    } catch (ClassNotFoundException ex) {
        println ("load Std. HTTP Manager")
        builder = new HttpManagerBuilder();
    }
}

@Override
public HttpManager configure(Config arg0) throws ServletException {
    ResourceFactory rf = new SResourceFactory();
    builder.setMainResourceFactory(rf);
    checkAddInitable(initables, builder.getMainResourceFactory());
    httpManager = builder.buildHttpManager();
    for( Initable i : initables ) {
        i.init(config, httpManager);
    }
    return httpManager;
}

@Override
public void shutdown() {
    httpManager.shutdown()
    for( Initable i : initables ) {
        i.destroy(httpManager);
    }        
}

private void checkAddInitable(List<Initable> initables, Object o) {
    if( o instanceof Initable) {
        initables.add((Initable)o);
    } else if( o instanceof List ) {
        for( Object o2 : (List)o) {
            checkAddInitable(initables, o2);
        }
    }
}
}

And here the ResourceFactory

class SResourceFactory implements ResourceFactory {

def fileSystemService

public SResourceFactory(){
    println "loading resource Factory"
    def ctx = ServletContextHolder.servletContext.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT)
    fileSystemService = ctx.fileSystemService
}

@Override
public Resource getResource(String host, String strPath)
throws NotAuthorizedException, BadRequestException {
    SResource sfr
    sfr = fileSystemService.getFolderByPath(strPath)
    return sfr
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:44:54+00:00Added an answer on June 13, 2026 at 4:44 am

    If you need Basic Auth – you have to enable it. So add the following line to the config method of the SMiltonConfig Class.

    builder.setEnableOptionsAuth(true); // enables auth
    builder.setEnableBasicAuth(true);   // optional 
    

    Here’S an example of the Resource authorise Method

        @Override
        public boolean authorise(Request r, Method m, Auth a) {
           return a != null;
        }
    

    Hope it helps

    Florian Pfann

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have written a small webapp using spring-security and spring-mvc with an annotation based
I have written a small webapp using the flask framework that involves plotting using
I have written a small Python application where I use PyGame for displaying some
I have written some small string parsing functions in F# - in order to
I have written a small program using Borland's C++ builder, and along the way,
I have written a small app using Ojective-C w/ XCode. It's only for personal
I have written a small rails app to serve up content to another site
I have written a small web application but am missing some cool functionality. I
I have written a small example C++ program, using boost::thread. Since it's 215 lines,
I have written a small application in C# using Visual Studio 2010. It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.