Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ public interface LogoutApi {
})
Response logout();


@POST
@Path("/unauthorize")
@ApiOperation(value = "Return UNAUTHORIZED 401 response")
Response unAuthorize();

@POST
@Path("/{user}")
@ApiOperation(value = "Logout and clean session if matching user logged")
Response logoutUser(
@ApiParam(value = "User to log out", required = true)
@PathParam("user") final String user);

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public Response logout() {
return Response.temporaryRedirect(dest).build();
}

@Override
public Response unAuthorize() {
return Response.status(Status.UNAUTHORIZED)
.header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_WEBCONSOLE)
.build();
}

@Override
public Response logoutUser(String user) {
// Will work when switching users, but will keep re-authenticating if user types in same user name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ limitations under the License.
<bean class="org.apache.brooklyn.rest.util.FormMapProvider"/>
<bean class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
<property name="contextName" value="webconsole"/>
<property name="realmName" value="webconsole"/>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets proper WWW-Authorization: Basic realm="something"

</bean>
<bean class="org.apache.brooklyn.rest.util.ManagementContextProvider">
<argument ref="localManagementContext"/>
Expand Down