001/* 002 * JGrapes Event Driven Framework 003 * Copyright (C) 2022 Michael N. Lipp 004 * 005 * This program is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Affero General Public License as published by 007 * the Free Software Foundation; either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, but 011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 013 * for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License along 016 * with this program; if not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jgrapes.webconlet.oidclogin; 020 021import java.net.URI; 022import org.jgrapes.core.Channel; 023import org.jgrapes.core.Components; 024import org.jgrapes.core.Event; 025 026/** 027 * The Class OpenLoginWindow. 028 */ 029public class OpenLoginWindow extends Event<Void> { 030 031 private final StartOidcLogin forLogin; 032 private final URI uri; 033 034 /** 035 * Instantiates a new open login window. 036 * 037 * @param forLogin the initial {@link StartOidcLogin} event 038 * @param uri the uri 039 */ 040 public OpenLoginWindow(StartOidcLogin forLogin, URI uri) { 041 this.forLogin = forLogin; 042 this.uri = uri; 043 } 044 045 /** 046 * Gets the initial {@link StartOidcLogin} event. 047 * 048 * @return the for login 049 */ 050 public StartOidcLogin forLogin() { 051 return forLogin; 052 } 053 054 /** 055 * Gets the uri. 056 * 057 * @return the uri 058 */ 059 public URI uri() { 060 return uri; 061 } 062 063 /* 064 * (non-Javadoc) 065 * 066 * @see java.lang.Object#toString() 067 */ 068 @Override 069 public String toString() { 070 StringBuilder builder = new StringBuilder(50); 071 builder.append(Components.objectName(this)) 072 .append(" [provider=").append(forLogin().provider()); 073 if (channels() != null) { 074 builder.append(", channels=").append(Channel.toString(channels())); 075 } 076 builder.append(']'); 077 return builder.toString(); 078 } 079 080}