001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 SonarSource SA
004 * mailto:info AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.server.authentication;
021
022import org.sonar.api.server.ServerSide;
023
024/**
025 * Entry-point to define a new Identity provider.
026 * Only one of this two interfaces can be used :
027 * <ul>
028 *   <li>{@link OAuth2IdentityProvider} for OAuth2 authentication</li>
029 *   <li>{@link BaseIdentityProvider} for other kind of authentication</li>
030 * </ul>
031 *
032 * @since 5.4
033 */
034@ServerSide
035public interface IdentityProvider {
036
037  /**
038   * Unique key of provider, for example "github".
039   * Must not be blank.
040   */
041  String getKey();
042
043  /**
044   * Name displayed in login form.
045   * Must not be blank.
046   */
047  String getName();
048
049  /**
050   * Display information for the login form
051   */
052  Display getDisplay();
053
054  /**
055   * Is the provider fully configured and enabled ? If {@code true}, then
056   * the provider is available in login form.
057   */
058  boolean isEnabled();
059
060  /**
061   * Can users sign-up (connecting with their account for the first time) ? If {@code true},
062   * then users can register and create their account into SonarQube, else only already
063   * registered users can login.
064   */
065  boolean allowsUsersToSignUp();
066
067}