= Setting up with Spring OAuth2

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:

This section describes how to setup and configure SecMan authorizor combined with xref:security:spring:about.adoc[Spring] being used as the authenticator, configured with xref:security:spring-oauth2:about.adoc[OAuth2].

In this scenario, we require that SecMan automatically creates any ``ApplicationUser``s as delegated users, meaning that they are defined externally (in the OAuth2 external store).

We use an extension module to register a service that performs this task.


== Configuration

Update your pom.xml:

[source,xml]
.pom.xml
----
<dependencies>
    <dependency>
        <groupId>org.apache.isis.extensions</groupId>
        <artifactId>isis-extensions-secman-delegated-spring-oauth2</artifactId>    <!--.-->
    </dependency>
</dependencies>
----

And update your `AppManifest`:

[source,java]
.AppManifest.java
----
@Configuration
@Import({
        ...
        IsisModuleExtSecmanDelegatedSpringOauth2.class,
        ...
})
public class AppManifest {
}
----

== ApplicationUsers cannot be DISABLED

This integration has one small limitation: it is not possible to disable delegated ``ApplicationUser``s.
Or rather, they can be disabled, but this will have no effect; the user will still be able to log in.
