|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the "Elastic License |
| 4 | + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side |
| 5 | + * Public License v 1"; you may not use this file except in compliance with, at |
| 6 | + * your election, the "Elastic License 2.0", the "GNU Affero General Public |
| 7 | + * License v3.0 only", or the "Server Side Public License, v 1". |
| 8 | + */ |
| 9 | + |
| 10 | +package org.elasticsearch.plugin.security.authz; |
| 11 | + |
| 12 | +import org.elasticsearch.action.ActionListener; |
| 13 | +import org.elasticsearch.common.util.concurrent.ThreadContext; |
| 14 | +import org.elasticsearch.logging.LogManager; |
| 15 | +import org.elasticsearch.logging.Logger; |
| 16 | +import org.elasticsearch.xpack.core.security.authc.AuthenticationResult; |
| 17 | +import org.elasticsearch.xpack.core.security.authc.AuthenticationToken; |
| 18 | +import org.elasticsearch.xpack.core.security.authc.Realm; |
| 19 | +import org.elasticsearch.xpack.core.security.authc.RealmConfig; |
| 20 | +import org.elasticsearch.xpack.core.security.user.User; |
| 21 | + |
| 22 | +public class MicrosoftGraphAuthzRealm extends Realm { |
| 23 | + |
| 24 | + private static final Logger logger = LogManager.getLogger(MicrosoftGraphAuthzRealm.class); |
| 25 | + |
| 26 | + public MicrosoftGraphAuthzRealm(RealmConfig config) { |
| 27 | + super(config); |
| 28 | + } |
| 29 | + |
| 30 | + @Override |
| 31 | + public boolean supports(AuthenticationToken token) { |
| 32 | + return false; |
| 33 | + } |
| 34 | + |
| 35 | + @Override |
| 36 | + public AuthenticationToken token(ThreadContext context) { |
| 37 | + return null; |
| 38 | + } |
| 39 | + |
| 40 | + @Override |
| 41 | + public void authenticate(AuthenticationToken token, ActionListener<AuthenticationResult<User>> listener) { |
| 42 | + listener.onResponse(AuthenticationResult.notHandled()); |
| 43 | + } |
| 44 | + |
| 45 | + @Override |
| 46 | + public void lookupUser(String username, ActionListener<User> listener) { |
| 47 | + logger.info("Looking up user... Not yet implemented so no roles resolved"); |
| 48 | + listener.onResponse(new User(username)); |
| 49 | + } |
| 50 | +} |
0 commit comments