/// <inheritdoc /> public GuildNameQueryController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, [JetBrains.Annotations.NotNull] IGuildEntryRepository guildRepository) : base(claimsReader, logger) { GuildRepository = guildRepository ?? throw new ArgumentNullException(nameof(guildRepository)); }
/// <inheritdoc /> public ZoneRegistryController([FromServices] IZoneServerRepository zoneRepository, IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { ZoneRepository = zoneRepository ?? throw new ArgumentNullException(nameof(zoneRepository)); }
/// <inheritdoc /> public ZoneServerRegistrationController([NotNull] UserManager <ZoneServerApplicationUser> userManager, [NotNull] ILogger <ZoneServerRegistrationController> logger, [FromServices] IClaimsPrincipalReader claimsReader) : base(claimsReader, logger) { UserManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); }
public ZonePersistenceController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, [NotNull] ICharacterSessionRepository characterSessionRepository) : base(claimsReader, logger) { CharacterSessionRepository = characterSessionRepository ?? throw new ArgumentNullException(nameof(characterSessionRepository)); }
public CharacterAppearanceController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, IRPGCharacterAppearanceRepository <TCustomizableSlotType, TColorStructureType, TProportionSlotType, TProportionStructureType> appearanceRepository, IRPGCharacterRepository <TRaceType, TClassType> characterRepository) : base(claimsReader, logger) { AppearanceRepository = appearanceRepository ?? throw new ArgumentNullException(nameof(appearanceRepository)); CharacterRepository = characterRepository ?? throw new ArgumentNullException(nameof(characterRepository)); }
/// <inheritdoc /> public AuthorizationController(IClaimsPrincipalReader claimsReader) { if (claimsReader == null) { throw new ArgumentNullException(nameof(claimsReader)); } ClaimsReader = claimsReader; }
public GameConfigController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, IAccountGameConfigurationRepository <TConfigType> accountConfigRepository, ICharacterGameConfigurationRepository <TConfigType> characterConfigRepository) : base(claimsReader, logger) { AccountConfigRepository = accountConfigRepository ?? throw new ArgumentNullException(nameof(accountConfigRepository)); CharacterConfigRepository = characterConfigRepository ?? throw new ArgumentNullException(nameof(characterConfigRepository)); }
/// <inheritdoc /> public CharacterZoneOnHubConnectionEventListener( [JetBrains.Annotations.NotNull] ILogger <CharacterZoneOnHubConnectionEventListener> logger, [JetBrains.Annotations.NotNull] ISocialServiceToGameServiceClient socialToGameClient, [JetBrains.Annotations.NotNull] IClaimsPrincipalReader claimsReader) { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); SocialToGameClient = socialToGameClient ?? throw new ArgumentNullException(nameof(socialToGameClient)); ClaimsReader = claimsReader ?? throw new ArgumentNullException(nameof(claimsReader)); }
/// <inheritdoc /> protected AuthorizationReadyController([FromServices] IClaimsPrincipalReader claimsReader, [FromServices] ILogger <AuthorizationReadyController> logger) : base(logger) { if (claimsReader == null) { throw new ArgumentNullException(nameof(claimsReader)); } ClaimsReader = claimsReader; }
// GET api/values /// <inheritdoc /> public WorldController(IClaimsPrincipalReader haloLiveUserManager, ILogger <WorldController> logger) : base(haloLiveUserManager) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } Logger = logger; }
/// <inheritdoc /> public CharacterController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, ICharacterRepository characterRepository) : base(claimsReader, logger) { if (characterRepository == null) { throw new ArgumentNullException(nameof(characterRepository)); } CharacterRepository = characterRepository; }
/// <inheritdoc /> public GeneralSocialSignalRHub(IClaimsPrincipalReader claimsReader, ILogger <GeneralSocialSignalRHub> logger, [JetBrains.Annotations.NotNull] IEnumerable <IOnHubConnectionEventListener> onConnectionHubListeners, [JetBrains.Annotations.NotNull] IEnumerable <IEntityCollectionRemovable> entityRemovable, [JetBrains.Annotations.NotNull] ISocialModelMessageRouter <IRemoteSocialHubClient> messageRouter) : base(claimsReader, logger) { OnConnectionHubListeners = onConnectionHubListeners ?? throw new ArgumentNullException(nameof(onConnectionHubListeners)); EntityRemovable = entityRemovable ?? throw new ArgumentNullException(nameof(entityRemovable)); MessageRouter = messageRouter ?? throw new ArgumentNullException(nameof(messageRouter)); }
/// <summary> /// Creates a new authorization ready controller. /// </summary> /// <param name="haloLiveUserManager">The user manager to be used for identity/user authorization functions.</param> protected AuthorizationReadyController([FromServices] IClaimsPrincipalReader haloLiveUserManager) { if (haloLiveUserManager == null) { throw new ArgumentNullException(nameof(haloLiveUserManager)); } //We NEED the usermanager because the easiest and cleanest way to access the identity claims such as ID is through //the user manager HaloLiveUserManager = haloLiveUserManager; }
/// <summary> /// Returns the User ID claim value if present otherwise will throw. /// </summary> /// <param name="principal">The <see cref="ClaimsPrincipal"/> instance.</param> /// <returns>The User ID claim value. Will throw if the principal doesn't contain the id.</returns> /// <exception cref="ArgumentException">Throws if the provided principal doesn't contain an id.</exception> /// <remarks>The User ID claim is identified by <see cref="ClaimTypes.NameIdentifier"/>.</remarks> public static int GetAccountIdInt(this IClaimsPrincipalReader reader, ClaimsPrincipal principal) { int accountId; if (!int.TryParse(reader.GetAccountId(principal), out accountId)) { throw new ArgumentException($"Provided {nameof(ClaimsPrincipal)} does not contain a user id.", nameof(principal)); } return(accountId); }
protected BaseCustomContentController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, UserContentType contentType) : base(claimsReader, logger) { if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } ContentType = contentType; }
/// <summary> /// Returns the User's character id. /// </summary> /// <param name="reader"></param> /// <param name="principal">The <see cref="ClaimsPrincipal"/> instance.</param> /// <returns>The User ID claim value. Will throw if the principal doesn't contain the id.</returns> /// <exception cref="ArgumentException">Throws if the provided principal doesn't contain an id.</exception> /// <remarks>The User ID's character id.</remarks> public static int GetCharacterId(this IClaimsPrincipalReader reader, ClaimsPrincipal principal) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } if (principal == null) { throw new ArgumentNullException(nameof(principal)); } return(reader.GetSubAccountId <int>(principal)); }
/// <summary> /// Returns the User's Sub-Account ID claim value if present otherwise will throw. /// </summary> /// <param name="reader"></param> /// <param name="principal">The <see cref="ClaimsPrincipal"/> instance.</param> /// <returns>The User ID claim value. Will throw if the principal doesn't contain the id.</returns> /// <exception cref="ArgumentException">Throws if the provided principal doesn't contain an id.</exception> /// <remarks>The User ID claim is identified by <see cref="ClaimTypes.NameIdentifier"/>.</remarks> public static TIdentifierType GetSubAccountId <TIdentifierType>(this IClaimsPrincipalReader reader, ClaimsPrincipal principal) where TIdentifierType : unmanaged { try { string id = reader.GetSubAccountId(principal); if (typeof(TIdentifierType) == typeof(string)) { return((TIdentifierType)(object)id); } if (id == default) { return(default);
/// <inheritdoc /> public TextChatHub(IClaimsPrincipalReader claimsReader, ILogger <TextChatHub> logger, [JetBrains.Annotations.NotNull] ISocialServiceToGameServiceClient socialToGameClient, [JetBrains.Annotations.NotNull] IConnectionToZoneMappable zoneLookupService, [JetBrains.Annotations.NotNull] IEnumerable <IOnHubConnectionEventListener> onConnectionHubListeners, [JetBrains.Annotations.NotNull] IServiceProvider serviceProvider, [JetBrains.Annotations.NotNull] IEntityDataLockingService entityLockService, [JetBrains.Annotations.NotNull] IEnumerable <IEntityCollectionRemovable> entityRemovable) : base(claimsReader, logger) { SocialToGameClient = socialToGameClient ?? throw new ArgumentNullException(nameof(socialToGameClient)); ZoneLookupService = zoneLookupService ?? throw new ArgumentNullException(nameof(zoneLookupService)); OnConnectionHubListeners = onConnectionHubListeners ?? throw new ArgumentNullException(nameof(onConnectionHubListeners)); ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); EntityLockService = entityLockService ?? throw new ArgumentNullException(nameof(entityLockService)); EntityRemovable = entityRemovable ?? throw new ArgumentNullException(nameof(entityRemovable)); }
//TODO: Doc. public static int GetPlayerAccountId(this IClaimsPrincipalReader reader, ClaimsPrincipal principal) { //Cannot get playeraccountid claim from non-zoneserver roles if (!principal.IsInRole(GladMMOAuthConstants.ZONESERVER_AUTHORIZATION_ROLE)) { throw new InvalidOperationException($"Failed to read Player AccountId Claim: {GladMMOAuthConstants.ACCOUNT_ID_OWNER_CLAIM_NAME} because provided identity did not have the zoneserver role."); } string accountIdString = principal.FindFirstValue(GladMMOAuthConstants.ACCOUNT_ID_OWNER_CLAIM_NAME); if (int.TryParse(accountIdString, out int resultValue)) { return(resultValue); } else { throw new InvalidOperationException($"Failed to read Player AccountId Claim: {GladMMOAuthConstants.ACCOUNT_ID_OWNER_CLAIM_NAME}"); } }
public SignalRPlayerCharacterUserIdProvider([JetBrains.Annotations.NotNull] ILogger <SignalRPlayerCharacterUserIdProvider> logger, [JetBrains.Annotations.NotNull] IClaimsPrincipalReader claimsReader) { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); ClaimsReader = claimsReader ?? throw new ArgumentNullException(nameof(claimsReader)); }
public AvatarPedestalDataController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }
/// <inheritdoc /> public CreatureInstanceDataController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }
// GET api/values /// <inheritdoc /> public WorldController(IClaimsPrincipalReader claimsReader, ILogger <WorldController> logger) : base(claimsReader, logger) { }
protected InstanceObjectDataController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }
/// <inheritdoc /> protected BaseNameQueryController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }
public GameObjectModelController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger, UserContentType.GameObject) { }
public ContentIconStaticClientOnlyController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }
/// <inheritdoc /> public CharacterSessionController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, [FromServices] ICharacterRepository characterRepository, [FromServices] ICharacterSessionRepository characterSessionRepository) : base(claimsReader, logger) { CharacterRepository = characterRepository ?? throw new ArgumentNullException(nameof(characterRepository)); CharacterSessionRepository = characterSessionRepository ?? throw new ArgumentNullException(nameof(characterSessionRepository)); }
public WorldController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger, UserContentType.World) { }
/// <inheritdoc /> public GuildController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger) : base(claimsReader, logger) { }