Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Implementing a custom authentication


Go to End


1270 Views

Avatar
Rudiger

Community Member, 8 Posts

9 November 2016 at 6:48pm

I'm planning to implement OAuth2 for my site and so far have member creation handled but need to sign in if they've authenticated too, while still allowing standard login.

Reading through available documentation it says to extend

Authenticator
and
LoginForm
which makes sense however looking around at others OAuth implementation they haven't done this at all, it's quite different, and most are very old.

What I believe I should be doing is:

MemberAuthenticator:
  extensions:
    - PlatformMemberExtension
MemberLoginForm:
  extensions:
    - PlatformLoginForm

class PlatformAuthenticator extends MemberAuthenticator {
	protected static function authenticate_member($data, $form, &$success) {
		//custom code here
	}
}

class PlatformLogin extends MemberLoginForm {
	// Not sure what to add here?
}

Is this the right track or should I be doing it differently?