[xwiki-devs] CAS Integration + new User creation

Marco Antonio González magonzalez at grupointermark.com
Fri Mar 25 10:08:23 UTC 2011

Thank you, i'll check it.

Marco A. González

----- Reply message -----
De: "Kevin Foote" <kpfoote at iup.edu>
Para: "Marco Antonio González" <magonzalez at grupointermark.com>, "Developers at xwiki. org (devs at xwiki.org)" <devs at xwiki.org>
Asunto: [xwiki-devs] CAS Integration + new User creation
Fecha: vie., mar. 25, 2011 10:06


I followed the sun-sso example here.
It should get you pointed in the right direction.


Sent from mobile

----- Reply message -----
From: "Marco Antonio González" <magonzalez at grupointermark.com>
Date: Fri, Mar 25, 2011 4:40 am
Subject: [xwiki-devs] CAS Integration + new User creation
To: "Developers at xwiki. org (devs at xwiki.org)" <devs at xwiki.org>

Hi all,

I'm new developing with XWiki, and I'm not sure this list is the correct to post this, so sorry in advance for any inconvenience and my bad english.

I'm trying to get an integration with CAS Auth instead of own XWiki Auth, but when I try to create a user on my own implementation of XWikiAuthServiceImpl, the user is created on XWiki space, but when i log into XWiki and Main is my default Space, the Profile link on top points to /xwiki/bin/view/Main/mynewuser instead of /xwiki/bin/view/XWiki/mynewuser where I can edit his first name, surname, etc. Is this the default behaviour? If not, any suggestions of what I do wrong?

The autentication code is, in my CASAuthServiceImpl class:

public XWikiUser checkAuth(XWikiContext context) throws XWikiException {
  String remoteUser = context.getRequest().getRemoteUser();
  String wikiname = "";
  if ((remoteUser == null) || remoteUser.equals("")) {
     getLogger().warn("checkAuth: User cannot be authenticated (REMOTE_USER is null)");
     try {
     } catch (IOException ioe) {
        getLogger().warn("checkAuth: CAS Error. Let XWiki handle it. ");
        return super.checkAuth(context);
  } else if (remoteUser.equalsIgnoreCase("xwiki")) {
     getLogger().warn("checkAuth: User is XWIKI (superadmin)");
     wikiname = "XWiki.superadmin";
  } else {
     XWiki wiki = context.getWiki();
     wikiname = wiki.clearName(remoteUser, true, true, context);
     this.context.getWiki().createEmptyUser(wikiname, "edit", context);
  return new XWikiUser(wikiname);
} catch (XWikiException e) {
  getLogger().error("checkAuth: Cannot validate user. " + e.getMessage());
  throw e;

Thank you,
Marco A. Gonzalez
devs mailing list
devs at xwiki.org

More information about the devs mailing list